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

Home -> Community -> Usenet -> c.d.o.server -> Re: Dynamic call of stored procedures.

Re: Dynamic call of stored procedures.

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 15 Jun 1998 10:42:09 GMT
Message-ID: <3589fa3f.16565109@192.86.155.100>


A copy of this was sent to rune.slinning_at_bigfoot.com (if that email address didn't require changing) On Mon, 15 Jun 1998 10:33:16 GMT, you wrote:

>Hi!
>
>I have a table in oracle which contains information of a set of stored
>procedures which I want to run in batch.
>
>I populate a cursor which contains procedure name. I then loop through the
>cursor and want to call the procedure using dynamic sql, but I can't get it to
>work. Anybody who can help me?
>
>Part of the code is shown below. Is this the way of calling stored procedures
>dynamically?
>
>open qa_cur;
>loop
> fetch qa_cur into qa_rec;
> exit when qa_cur%NOTFOUND;
>
> -- process data record
>
> dbms_c1 := dbms_sql.open_cursor;
> dbms_sql.parse(dbms_c1,qa_rec.proc_name,dbms_sql.v7);

what does qa_rec.proc_name look like? If its just the name of a procedure, then you need to:

dbms_sql.parse( dbms_c1, 'begin ' || qa_rec.proc_name || '; end;', dbms_sql.v7);

Add the begin/end pair to make it a valid pl/sql block...

> rows := dbms_sql.execute(dbms_c1);
> dbms_sql.close_cursor(dbms_c1);
>
>end loop;
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Jun 15 1998 - 05:42:09 CDT

Original text of this message

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