Oracle 显示游标

create or replace procedure 显示游标更新
as
--select taid, taname, bqid from table3
new_taid number;
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;--遍历之前进行判断,不为空进行更新
  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 显示游标更新;

posted @ 2012-06-10 22:22  blog_yuan  阅读(624)  评论(0编辑  收藏  举报