declare
i integer;
j integer;
begin
i := 1;
j := 1;
<<main_loop>>
for i in 1 .. 10 loop
---主循环---
for j in 1 .. 10 loop
---次循环---
exit main_loop when i=2;
if j = 3 then
exit; ---退出当前循环---
end if;
if i = 5 then
exit main_loop; ---退出主循环---
end if;
/*
exit main_loop when i=5;
*/
dbms_output.put_line('j的值为' || j);
end loop; ---次循环结束---
dbms_output.put_line(i);
end loop main_loop; ---主循环结束---
exception
when others then
dbms_output.put_line(sqlerrm);
end;
oracle 中退出循环的用法
最新推荐文章于 2024-02-02 09:40:25 发布