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;