简单条件判断语句
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.