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: Call subprogram

Re: Call subprogram

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 07 Jan 2000 08:50:31 -0500
Message-ID: <4nrb7skp8hniposkflb4aja2om6r41d9s0@4ax.com>


A copy of this was sent to ulysse51_at_my-deja.com (if that email address didn't require changing) On Fri, 07 Jan 2000 13:30:25 GMT, you wrote:

>hi,
>in PL/SQL
>i want to call a procedure in a procedure. the probleme is that the
>name and the arguments of the procedure i want to call are in a string
>
>thank you for help
>regards
>
>
>ulysse51_at_my-deja.com
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

dbms_sql in 8.0 and before. EXECUTE IMMEDIATE in 8i and up.... for example:

tkyte_at_8i> create or replace procedure execute_immediate( sql_stmt in varchar2 )   2 as

  3      exec_cursor     integer default dbms_sql.open_cursor;
  4      rows_processed  number  default 0;
  5  begin
  6      dbms_sql.parse(exec_cursor, sql_stmt, dbms_sql.native );
  7      rows_processed := dbms_sql.execute(exec_cursor);
  8      dbms_sql.close_cursor( exec_cursor );
  9 end;
 10 /

Procedure created.

tkyte_at_8i> begin
  2 execute_immediate( 'begin dbms_output.put_line( ''Hello World'' ); end;' );
  3 end;
  4 /
Hello World

PL/SQL procedure successfully completed.

works in 8.0 and before... the following:

tkyte_at_8i> begin
  2 execute immediate 'begin dbms_output.put_line( ''Hello World'' ); end;';
  3 end;
  4 /
Hello World

PL/SQL procedure successfully completed.

is the easier way in 8i and later.

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Jan 07 2000 - 07:50:31 CST

Original text of this message

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