• 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;
  • 相关阅读:
    HDU 5698 瞬间移动
    HDU 5695 Gym Class
    HDU 5694 BD String
    HDU 5692 Snacks
    HDU 5691 Sitting in Line
    胜利大逃亡
    BFS(广度优先搜索)
    计算直线的交点数
    Division
    Jesse's Code
  • 原文地址:https://www.cnblogs.com/goingforward/p/5846163.html
Copyright © 2020-2023  润新知