[Oracle]匿名循环过程语句实验[转]

--loop/相当于do while
declare
number:=0;
number:=1;
begin
loop
exit when i<=10;
s:
=s+i;
i:
=i+1;
end loop;
dbms_output.put_line(s);
end;

-while
declare
number:=0;
number:=1;
begin
while i<=10 loop
s:
=s+i;
i:
=i+1;
end loop;
dbms_output.put_line(s);
end;


--for
declare
number:=0;
begin
for i in 1..10 loop
s:
=s+i;
end loop;
dbms_output.put_line(s);
end;


--goto
declare
number:=0;
begin
for i in 1..10 loop
declare
number:=9;
begin

dbms_output.put_line(i);
end;
end loop;
end;

转自:http://hi.baidu.com/boaby_tdk/blog/item/17049a5884e8a2de9d82044f.html
原文地址:https://www.cnblogs.com/xinyuxin912/p/490012.html