Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

pl/sql: dynamic sql, writing to file

492850Feb 24 2006 — edited Feb 24 2006
I have a pl/sql procedure in which I dynamically generate a select statement (as a varchar2 v_my_query).

I now need to execute this query and write the results to a file using utl_file.

I can do 'execute immediate v_my_query', but how does this get the result to a file? Can I somehow get it into a cursor? The table name is a parameter to the procedure so I can't create the cursor up front.

I'm trying to do it all in one go - otherwise I'd write the v_my_query to a script and then run it from sqlPLUS with spool.

Any suggestions???
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 24 2006
Added on Feb 24 2006
2 comments
620 views