oracle 中退出迴圈的用法

2021-05-23 16:43:08 字數 673 閱讀 6570

declare

i integer;

j integer;

begin

i := 1;

j := 1;

<>

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,程式退出死迴圈

在程式中使用sqldriverconnect連線oracle資料庫 沒有關閉sql控制代碼就退出程式了。結果在debug模式下出現死迴圈,還是在exitprocess函式裡,以前沒有碰到開啟後不關閉程式會無法退出,也沒見過exitprocess不能退出來的。猜想是不是oracle的dll沒做好退出這...

python中退出多層迴圈的方法

1 定義標記變數 利用變數值的變化退出迴圈 第一種巢狀形式 在將標記變數變為false之後,要退出第一層迴圈break a 1,2,3 5,5,6 7,8,9 init i 0 init j 0 flag true for i in range 3 for j in range 3 print i,...

Oracle中的迴圈

主要有以下五種迴圈 exit when loop while for 普通迴圈 for 游標迴圈 下面舉例一一說明 均為儲存過程 1 exit when迴圈 create or replace procedure proc test exit when is i number begin i 0 l...