过水漫游沙皮,中国智能交通,溺生长下
if 条件 then 语句序列; end if;
declare i number(2) := 10; begin if i < 20 then dbms_output.put_line('true'); end if; end;
if 条件 then 语句序列1; else 语句序列2; end if;
declare i number(2) := 10; begin if i < 10 then dbms_output.put_line('true'); else dbms_output.put_line('false'); end if; end;
if 条件1 then 语句序列1; elsif 条件2 then 语句序列2; else 语句序列3; end if;
declare i number(2) := 10; begin if i < 10 then dbms_output.put_line('true1'); elsif i < 20 then dbms_output.put_line('true2'); else dbms_output.put_line('false'); end if; end;
注:可以在一个if-then
或if-then-elsif
语句中使用另一个if-then
或if-then-elsif
语句。
case selector when 'value1' then 语句序列1; when 'value2' then 语句序列2; when 'value3' then 语句序列3; ... else 语句序列n; -- default case end case;
declare sex char(1) := '1'; begin case sex when '1' then dbms_output.put_line('男'); when '2' then dbms_output.put_line('女'); else dbms_output.put_line('ry'); end case; end;
case when selector = 'value1' then 语句序列1; when selector = 'value2' then 语句序列2; when selector = 'value3' then 语句序列3; ... else 语句序列n; -- default case end case;
declare sex char(1) := '1'; begin case when sex = '1' then dbms_output.put_line('男'); when sex = '2' then dbms_output.put_line('女'); else dbms_output.put_line('ry'); end case; end;
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Oracle字符串函数length、upper、lower、initcap、 concat、instr、replace
网友评论