更新游标包括两部分:1. 声明游标时,cursor mycur is select * from test for update --锁定了表的整行.
2. cursor mycur is select * from test for update of name --只锁定name这个列
where current of mycur 只更新当前行。
更新游标包括两部分:
declare
cursor mycur is select * from test for update;
myrec test%rowtype;
begin
open mycur;
fetch mycur into myrec;
while mycur%found loop
update test set name = name || 'yes' where current of mycur;
fetch mycur into myrec;
end loop;
close mycur;
commit;
end;