Home » SQL & PL/SQL » SQL & PL/SQL » Execute SQL Saved in Table
Execute SQL Saved in Table [message #212283] Thu, 04 January 2007 09:06 Go to next message
Bean
Messages: 2
Registered: September 2006
Junior Member
I have a table ("TheSQL")that contains one field ("SQL_STMTS"), and that field is populated with SELECT statements. e.g.,

Table: TheSQL
SQL_STMTS
===========
SELECT Count(*) FROM WSCCT_TAB1
SELECT Count(*) FROM WSCCT_TAB2
SELECT Count(*) FROM WSCCT_TAB3
SELECT Count(*) FROM WSCCT_TAB4
SELECT Count(*) FROM WSCCT_TAB5
etc.

How can I query through these, and execute each one (using PL/SQL).

[Updated on: Thu, 04 January 2007 09:08]

Report message to a moderator

Re: Execute SQL Saved in Table [message #212285 is a reply to message #212283] Thu, 04 January 2007 09:09 Go to previous messageGo to next message
anilsinare
Messages: 22
Registered: December 2005
Location: ipswich, uk
Junior Member
You can use execute immediate. But if you are expecting more than one row then you should use ref cursor for this.
Re: Execute SQL Saved in Table [message #212295 is a reply to message #212285] Thu, 04 January 2007 09:57 Go to previous message
Bean
Messages: 2
Registered: September 2006
Junior Member
thanks! execute immediate did the trick!
Previous Topic: coulmn
Next Topic: Identify who is locks my entity
Goto Forum:
  


Current Time: Sat Dec 03 08:26:12 CST 2016

Total time taken to generate the page: 0.10877 seconds