更新游标的用法

来源:互联网 发布:三峡大学网络系统 编辑:程序博客网 时间:2024/05/18 06:30

 更新游标包括两部分: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;

原创粉丝点击