declare
v_name varchar(20) :='liuhu';
v_num number :=0;
cursor test_cursor is select * from base_country;
1、for循环
begin
for i in 1..10 loop
if mod(i,2)=0 then
dbms_outout.put_line(v_name || i);
exit;--exit退出循环;return退出存储过程
end if;
end loop;
end;
2、loop循环
begin
loop
v_num:=v_num+1;
if v_num >5 then
exit;
end loop;
end
3、while 循环
begin
while v_num>5 loop
v_num :v_num+1;
dbms_output.put_line('while circle '|| v_num);
exit when v_num>20;
end loop;
end;
4、goto语句
for country in test_cursor loop
if country.iso='CN' then
goto reapt_point;
end if;