Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to pass procedures as parameters?

Re: How to pass procedures as parameters?

From: Connor McDonald <mcdonald.connor.cs_at_bhp.com.au>
Date: Tue, 23 Mar 1999 10:04:55 +0800
Message-ID: <36F6F6C7.18A@bhp.com.au>


earthlink wrote:
>
> can any one tell me how to pass a procedure as a parameter,
> and execute it in the called program.
>
> TIA
>
> Phil

Sorry - let me try again now that I have read your post properly...

Use DBMS_SQL to run dynamic sql...

Example:

create procedure run_any_proc(v_proc_name varchar2) is   t integer;
  d integer;
begin
  t := dbms_sql.open_cursor;
  dbms_sql.parse(t,'begin '||v_proc_name||'; end;',dbms_sql.native);   d := dbms_sql.execute(t);
  dbms_sql.close(t);
exception when others then
  dbms_sql.close(t);
  raise;
end;

In 8i, just use "execute_immediate"

--



Connor McDonald
BHP Information Technology
Perth, Western Australia
"Never wrestle a pig - you both get dirty and the pig likes it..." Received on Mon Mar 22 1999 - 20:04:55 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US