Oracle 游标实例

declare
 
linenumA varchar2(30);
skdwA varchar2(30);
 
cursor getlines is
select linenum,skdw from zw_skdwqr 
where linenum in('2009121669117392') 
and qrbz=1 and lx=1 ;
 
begin
 
if getlines%isopen = false then
 
open getlines;
 
end if;
 
fetch getlines into linenumA,skdwA;
 
while getlines%found 
loop
delete from zw_skdwqr where linenum=linenumA and lx=1
and skdw=skdwA and qrbz=2;
commit;
fetch getlines into linenumA,skdwA;
end loop;
close getlines;
end;
待人以诚,做事用心,对事不对人.
原文地址:https://www.cnblogs.com/jiangguang/p/2761070.html