9.2 branch structure

Features:

1, if the function

Features: simple double branch
grammar:
if (condition value 1, value 2)
 
position:
It can be used as the expression in any position

2, case structure

Features: multi-branch
Syntax 1:
case expression or field
when value 1 then statement 1;
Statement 2 then 2 when value;
......
else statement n;
end [case];
 
Syntax 2:
case
when condition 1 then statement 1;
2 then statement when condition 2;
..
else statement n;
end [case];
 
 
position:
It can be placed anywhere,
If on the outside begin end, as the expression combined with other statements use
If placed inside begin end, generally used as a stand-alone statement

3, if the structure

Features: multi-branch
grammar:
if condition 1 then statement 1;
elseif Condition 2 then statement 2;
...
else statement n;
end if;
position:
Can be placed only begin end in
 

Guess you like

Origin www.cnblogs.com/huabro/p/12630407.html