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 显示游标更新;

转载于:https://www.cnblogs.com/yuan-2012/archive/2012/06/10/2544354.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值