if else
if(to_number(to_char(target,'MM'))=2) Then
m1:=12;
m2:=1;
m3:=2;
elsif(to_number(to_char(target,'MM'))=1) then
m1:=11;
m2:=12;
m3:=1;
else
m1:=(to_number(to_char(target,'MM'))-2)||'月';
m2:=(to_number(to_char(target,'MM'))-1)||'月';
m3:=to_number(to_char(target,'MM'))||'月';
end if; -- 注意 elsif 不是elseif
loop exit end
declare
v_num integer :=0;
v_sum integer :=0;
begin
Loop
if v_sum>10 then
exit;
end if;
dbms_output.put_line(v_sum);
v_num :=v_num+1;
v_sum:=v_num+v_sum;
end loop;
end;
loop exit when end
declare
v_num integer :=0;
v_sum integer :=0;
begin
Loop
exit when v_sum>20;
dbms_output.put_line(v_sum);
v_num :=v_num+1;
v_sum:=v_num+v_sum;
end loop;
end;
while 循环 while ... loop ...end loop
declare
v_num integer :=0;
v_sum integer :=0;
begin
while v_sum<100
loop
dbms_output.put_line(v_sum);
v_num:=v_num+1;
v_sum:=v_sum+v_num;
end loop;
end;
for 循环 for ... in.... loop ... end loop
declare
v_num integer :=0;
v_sum integer :=0;
begin
for v_num in 1..10
loop
dbms_output.put_line(v_num);
end loop;
end;
case
select case '6' when '5' then 55
when '6' then 66
else 77 end
from dual;
select case when 1!=1 then '11'
when 2!=2 then '22'
else '33' end
from dual;