过程

最近更新时间: 2024-10-17 17:10:00

使用CREATEPROCEDURE 创建过程

示例:支持using out用法

set enable_oracle_compatible to on;

begin
    PERFORM DBMS_OUTPUT.ENABLE();
    PERFORM DBMS_OUTPUT.SERVEROUTPUT ('t');
end;
/

create or replace procedure using_out_p1(a_ret out number) is
begin
    a_ret:=10;
end;
/

create or replace procedure using_out_p2(a_ret out number, b_ret out varchar) is
begin
    a_ret:=10;
    b_ret:='ok';
end;
/

create or replace procedure using_out_p3(a_ret out number, b_ret out varchar, c_out in out numeric) is
begin
    a_ret:=10;
    b_ret:='ok';
    c_out := c_out+10;
end;
/


-- TestPoint : 一个out参数
create or replace procedure p_1 is
    vsql varchar(500);
    v_ret number;
begin
    vsql:='call using_out_p1(:1)';
    execute immediate vsql using out v_ret;
    perform dbms_output.put_line(v_ret);
end;
/

call p_1();