Subject Re: [IBO] better way of update ?
Author Jason Wharton
Not sure if this is better but in cases where things get messy I will
sometimes write a stored procedure that uses a JOIN to pull information
together and include in the query a DB_KEY for the record I want to update
and then in the body of the FOR SELECT I will perform an update on that
particular record with the DB_KEY in the WHERE clause. This way it is VERY
fast.

If it is a table and not a view a DB_KEY or RDB$DB_KEY is CHAR(8). I cannot
remember all the funky rules but there are times you see the RDB$ removed. I
think its in the FieldName returned in a synamic query but when in a SQL
string you have to include the RDB$.

HTH,
Jason Wharton

----- Original Message -----
From: "Safak Ebesek" <safak@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, October 22, 2003 6:39 AM
Subject: [IBO] better way of update ?


> Hi,
>
> Dou You know better way or short syntax for query below:
>
> (Without EXISTS, the query will set the region number to NULL)
>
> update customer as c
> set region =
> (select newregion
> from fixes
> where oldregion = c.region)
> where exists
> (select *
> from fixes
> where oldregion = c.region)
>
> Thanks,
> Safak
>