天天看点

动态存储过程

我从A表中查出的存储过程名称是D。从B表中查出D存储过程的参数是E,F。我在C存储过程中要实现,调用D,并且传参E,F。

create or replace procedure D (outProcedureNm  out varchar ) is 

  begin

    select

      A.ProcedureNm

    from

      a

    into

      outProcedureNm  ; 

        exception

    when the others

      null;

  end;

create or replace procedure C  is

  varE varchar(10) ;

  varF varchar(10) ;

  varProcedureNm varchar(100);

  var varSql varchar2(1000);

  begin

    select

    B.E,B.F

    from B

    into inVarE ,inVarF;

    --call D

    D(varProcedureNm);

    varSql := 'begin ' || varProcedureNm|| ' (:v1,:v2); end;'; 

    execute immediate varSql  using in inVarE ,in inVarF;

  exception

    when the others

      null;

  end;