Oracle显示游标简析(转载)
Oracle显示游标简析
create or replace procedure 显示游标更新
as
--select taid, taname, bqid from table3
new_taid number; 上海oracle培训landscaper-academy.com
cursor cur_table is --显示声明游标
select taid from table3 where taid < 10
for update of taid; --taid在<10的范围之内进行锁定
c_row cur_table%rowtype; --返回行的数据
begin
open cur_table;
loop
fetch cur_table into new_taid;
exit when cur_table%notfound;--遍历之前进行判断notfound ,不为空进行更新
update table3 set taid=1+new_taid--taid > 10 并且出现重复的值就不在累加
where current of cur_table; --锁定的游标
dbms_output.put_line('taid=:' ||new_taid);
end loop;
close cur_table;
commit;
end 显示游标更新;
爱资源吧版权声明:以上文中内容来自网络,如有侵权请联系删除,谢谢。