IF語句結構:oop
if(條件表達式)-spa
-then-it
-執行語句;-搜索
-end;循環
IF-THEN-ELSE語句結構:異常
if(條件表達式)-db
-then-loop
-執行語句;-while
-else-co
-執行語句;-
end;
ELSIF語句:
if(條件表達式)-
-then-
-執行語句;-
-elsif-
-執行語句;-
-elsif-
-執行語句;-
-else-
-執行語句;-
end;
注意:elsif語句是順序執行的,各個執行條件之間是互斥的關係,在使用該語句是須要注意條件的順序關係。
IF嵌套:
if(條件表達式)-
-then-
(-執行語句;-)
If (條件表達式)-
-then
-執行語句;-
-else-
-執行語句;-
end;
-else-
-then-
-執行語句;-
end;
CASE語句:
Case 的兩種行爲方式。
一,簡單的case語句,case 選擇器 when xxx then xxx
二,搜索式 case when xxx then xxx 這個是沒有選擇器的。
循環控制語句:
1.基本循環機構:
loop
執行語句
end loop;
2.While循環:
while vars<=12 loop
執行語句;
end loop;
3.for循環:
for i in 1..10 loop
執行語句;
end loop;
i從1-10循環執行
中斷控制
①exit 退出 ②exit when(先執行在判斷)
順序控制
①continue 繼續 ②continue when(先執行在判斷)
NULL語句:
Null是一種判斷語句,在流程控制中,意味着什麼也不作
If name=’sun’
then
dbms_output.put_line(‘name=’||name);
else
null;--
Null起到了屏蔽異常的做用,不須要處理異常的場合就能夠使用null不作任何事情。
end;