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;

 

你可能感兴趣的:(oracle)