Oracle 存储过程
create procedure proc_1 as
begin
dbms_output.put_line('hello boy ');
end proc_1;
--set serveroutput on; exec proc_1;
create or replace procedure proc_2(v_1 in varchar2,v_2 out varchar2)
as
begin
v_2:='hello ' || v_1;
end proc_2;
/*
declare v_2 varchar2(100);
begin
proc_2('boy',v_2);
dbms_output.put_line(v_2);
end;
*/
create or replace procedure proc_3(v_1 in number,v_2 out number)
as
begin
if v_1<1 then
begin
v_2 := v_1 + 1;
end;
end if;
if v_1 > 1 and v_1 < 3 then
begin
v_2 := v_1 + 2;
end;
elsif v_1 > 2 then
begin
v_2 := v_1 + 3;
end;
end if;
end proc_3;
create or replace procedure proc_4(v_1 in number)
as
v_2 number(4);
begin
v_2 := v_1;
while v_2 < 10 loop
begin
dbms_output.put_line(v_1);
v_2 := v_2 + 1;
end;
end loop;
end proc_4;