PL/SQL学习(二)条件和循环语句
PLSQL条件语句
IF THEN ELSE STATEMENT
1)
IF condition
THEN
statement 1;
ELSE
statement 2;
END IF;
2)
IF condition 1
THEN
statement 1;
statement 2;
ELSIF condtion2 THEN
statement 3;
ELSE
statement 4;
END IF
3)
IF condition 1
THEN
statement 1;
statement 2;
ELSIF condtion2 THEN
statement 3;
ELSE
statement 4;
END IF;
4)
IF condition1 THEN
ELSE
IF condition2 THEN
statement1;
END IF;
ELSIF condition3 THEN
statement2;
END IF;
CASE语句
1)
CASE selector
WHEN expression1 THEN operation1
WHEN expression2 THEN operation2
...
WHEN expressionN THEN operationN
ELSE default_operation
END CASE;
2)
CASE
WHEN condition1 THEN operation1
WHEN condition2 THEN operation2
...
WHEN conditionN THEN operationN
ELSE default_operation
END CASE;
PLSQL循环语句
简单一般循环(相当于do while循环)
LOOP
statements;
EXIT;
{or EXIT WHEN condition;}
END LOOP;
While循环
WHILE <condition>
LOOP statements;
END LOOP;
For循环
FOR counter IN val1..val2
LOOP statements;
END LOOP;
本博客文章皆出于学习目的,个人总结或摘抄整理自网络。引用参考部分在文章中都有原文链接,如疏忽未给出请联系本人。另外,作为一名菜鸟程序媛,如文章内容有错误,欢迎点击博客右上方的扣扣链接指导交流。