Subject Re: [ib-support] update problem
Author Dimitry Sibiryakov
On 16 Jul 2002 at 17:16, Ben Johnson wrote:

>UPDATE product P SET product_nm = (select product_nm
> FROM new_product NP where NP.id = P.id) ;
>
>Is the above SQL statment correct? I just want to replace
>the product name in the product table with the name from
>the new_product table.

If I were you, I'd put this work into a stored procedure. Something
like that:

CREATE PROCEDURE UpdateProduct AS
DECLARE VARIABLE new_product_nm VARCHAR(200);
DECLARE VARIABLE new_product_id INTEGER;
BEGIN
FOR SELECT id, product_nm
FROM new_product
INTO :new_product_id, :new_product_nm DO
UPDATE product SET product_nm=:new_product_nm
WHERE id=:new_product_id;
END#

SY, Dimitry Sibiryakov.