plsql 的三种循环

set serveroutput on

declare
pnum number :=1 ;

begin

while pnum<=10 loop
dbms_output.put_line(pnum);
pnum :=pnum+1;

end loop;

end;
/



set serveroutput on

declare
pnum number :=1 ;

begin
loop
exit when pnum>10;
dbms_output.put_line(pnum);
pnum :=pnum+1;
end loop;

end;
/






set serveroutput on

declare
pnum number :=1 ;

begin
 for pnum in 1..10 loop
dbms_output.put_line(pnum);

end loop;

end;
/

 

posted @ 2019-06-02 19:16  小啊菜鸡  阅读(1489)  评论(0编辑  收藏  举报