条件语句
1.if 语句
create or replace procedure pro_emp1(aa in number)
as
begin
if aa =1 then
dbms_output.put_line('jdmd');
end if;
end pro_emp1;
2.if elsif 语句
create or replace procedure pro_emp2(aa number)
as
begin
if aa =1 then
dbms_output.put_line('jdmd');
elsif aa =2 then
dbms_output.put_line('knjw');
else
dbms_output.put_line('ayxdl');
end if;
end pro_emp2;
3.when 语句
create or replace PROCEDURE PRO_EMP3
(
AA IN NUMBER
) AS
BEGIN
case aa
when 1 then
dbms_output.put_line('sky');
when 2 then
dbms_output.put_line('sky2');
else
dbms_output.put_line('sk3');
end case;
END PRO_EMP3;
循环语句
1.goto 循环
create or replace procedure pro_x1
as
x number;
begin
x:=1;
<<gz_goto>>
x:=x+1;
dbms_output.put_line(x);
if x <5 then
goto gz_goto;
end if;
end pro_x1;
2.loop 循环
create or replace PROCEDURE PRO_X2
AS
x number;
BEGIN
x :=1;
loop
exit when x>9;
x:= x+1;
dbms_output.put_line(x);
end loop;
END PRO_X2;
3.for 循环
create or replace PROCEDURE PRO_X3 AS
x number;
BEGIN
for x in 1..9 loop
dbms_output.put_line(x);
end loop;
END PRO_X3;
4.while 循环
create or replace PROCEDURE PRO_X4 AS
x number;
BEGIN
x:=1;
while x<9 loop
x:=x+1;
dbms_output.put_line(x);
end loop;
END PRO_X4;