Skip to Main Content
  • Questions
  • How to print dynamic SQL where SELECT, FROM and WHERE is dynamic

Breadcrumb

May 4th

Question and Answer

Tom Kyte

Thanks for the question.

Asked: March 12, 2001 - 7:09 am UTC

Last updated: March 13, 2001 - 1:35 pm UTC

Version: 7.3.4

Viewed 1000+ times

You Asked

I want to write a procedure which executes my dynamic query. I want to call this procedure to execute different queries and print the results (Columns)

and Tom said...

See
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:235814350980

it shows how to dynamically create a flat file from any query using DBMS_SQL.  Change the UTL_FILE calls to dbms_output and you have what you need.

See also:

http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1035431863958 <code>

which is another example of the above which uses dbms_output. It prints query results down the page instead of across.



Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, March 13, 2001 - 1:35 pm UTC


More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library