• 『ORACLE』 PLSQL条件控制语句(11g)


    简单条件判断语句

    SQL> declare
    2 myage number := 10;
    3 begin
    4 if myage < 11 then
    5 dbms_output.put_line('I am a child');
    6 end if;
    7 end;
    8 /

    I am a child

    PL/SQL procedure successfully completed.

    SQL> 2
    2* myage number := 10;
    SQL> ch /10/14
    2* myage number := 14;
    SQL> /

    PL/SQL procedure successfully completed.

    二重条件判断语句

    SQL> declare
    2 myage number :=18;
    3 begin
    4 if myage < 11 then
    5 dbms_output.put_line('I am a child');
    6 else
    7 dbms_output.put_line('I am not a child');
    8 end if;
    9 end;
    10 /
    I am not a child

    PL/SQL procedure successfully completed.

    多重条件判断语句

    SQL> set serveroutput on
    SQL> declare
    2 myage number:=30;
    3 begin
    4 if myage < 11 then
    5 dbms_output.put_line('I am a child');
    6 elsif myage < 20 then
    7 dbms_output.put_line('I am young');
    8 else
    9 dbms_output.put_line('I am alawys young');
    10 end if;
    11 end;
    12 /
    I am alawys young

    PL/SQL procedure successfully completed.

  • 相关阅读:
    exit()和_exit()函数(转)
    C语言struct内存占用问题 (转)
    C语言中memset函数(转)
    STDIN_FILENO与stdin区别(转)
    stderr,strerror,errno,perror,论坛大神的回答!
    C++ 函数模版
    C++ 内置函数
    offsetof
    LockSupportDemo
    读写锁,await和signa
  • 原文地址:https://www.cnblogs.com/KT-melvin/p/6849934.html
Copyright © 2020-2023  润新知