|Subject||Re: [ib-support] Update in SP|
|Author||Ann W. Harrison|
>At 11:17 AM 09-05-01 +0300, Dorin wrote:At 10:07 PM 5/9/2001 +1000, Helen Borrie wrote:
> >Hi everyone !
> >How can I update a table in a SP using a FOR SELECT ... clause ?
> >FOR SELECT <some columns> from <table> into <vars> DO BEGIN
> > ... Here is the updating part ...
>In a FOR SELECT loop on one table you can use the selected data to updateHelen must have been having an off day.
>another table but not to update the one which is the subject of the loop, e.g.
Something like this will work:
for select <primary key> from <table> where <condition>
update <table> set <assignments> where <primary key> = <variable>
There are a couple of variants that might be slightly faster (using
the undocumented cursor mechanism or db_keys) but as all the structures
you're using will be in cache, the difference is unlikely to be
we have answers