Subject | Re: [IBO] select ... for update (2nd post) |
---|---|
Author | pepmallorca |
Post date | 2002-03-06T10:33:57Z |
select ...for update is used in some databases like ORACLE, to
indicate the columns to be updated in a CURSOR:
Ex (I don't remember exactly the sintaxis):
declare
cursor c is
select id,price
from table
where price=50
for update of price
begin
for v_record in c do
begin
insert into table2(id) values (v_record.id);
update table set price=price*2 where current of v_record;
end
end
This example is not too good, because is the same as:
update table set price=price*2 where price=50
but I hope you understand the idea.
In INTERBASE I use DB_KEY to do the same thing. It's very similar.
In some cases I prefere FOR UPDATE, but DB_KEY works good.
Bye,
indicate the columns to be updated in a CURSOR:
Ex (I don't remember exactly the sintaxis):
declare
cursor c is
select id,price
from table
where price=50
for update of price
begin
for v_record in c do
begin
insert into table2(id) values (v_record.id);
update table set price=price*2 where current of v_record;
end
end
This example is not too good, because is the same as:
update table set price=price*2 where price=50
but I hope you understand the idea.
In INTERBASE I use DB_KEY to do the same thing. It's very similar.
In some cases I prefere FOR UPDATE, but DB_KEY works good.
Bye,