Curson

declare
cursor c_user is
select id,subscriberidentify,msisdn from t_pcc_subscriber;
c_user1 c_user%rowtype;

begin
open c_user;
loop
fetch c_user into c_user1;
if c_user%found then
dbms_output.put_line(c_user1.subscriberidentify);
end if;

exit when c_user%NOTFOUND;
end loop;
close c_user;

end;


declare
type tmp_curson is ref cursor;
v_curson tmp_curson;
Shop_Name varchar2(50);
c_exp exception;
begin

open v_curson for select Shop_Name from SHOP;
loop
fetch v_curson into Shop_Name;
if v_curson%found then
dbms_output.put_line(Shop_Name);
update SHOP set Shop_Name = '9999888' where Shop_Id = 6;
SAVEPOINT SPT_ADD_SUBSCRIPTION;
-- update SHOP set Shop_Name = '9999888' where Shop_Id = 6;
raise c_exp;
end if;

exit when v_curson%notfound;
end loop;
close v_curson;
commit;

exception
when c_exp then
dbms_output.put_line('c_exp...');
ROLLBACK TO SAVEPOINT SPT_ADD_SUBSCRIPTION;
when others then
dbms_output.put_line(Sqlerrm);

end;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值