Skip to Main Content

Oracle Database Discussions

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!

How to pass table name dynamic in sql

943793Jul 16 2012 — edited Jul 20 2012
Hi

For one specific requirement I need to come up a quesry as follows for my dataset.

select * FROM ASSET_REQUEST_29 UNION ALL
select * FROM ASSET_REQUEST_31 UNION ALL
select * FROM ASSET_REQUEST_32 UNION ALL
select * FROM ASSET_REQUEST_33 UNION ALL
select * FROM ASSET_REQUEST_34 UNION ALL
select * FROM ASSET_REQUEST_36

Problem here is there is possibility of that if in future new version of the "ASSET_REQUEST" is created like "ASSET_REQUEST_37, ASSET_REQUEST_38" then I won't be able to capture the information from the same. I need to modify the query again.

Please suggest , how can I achieve the approach where I can dynamically pass the table

I am using the Oracle 11g

Let me know if I need to provide any details further.

Thanks
AR

Edited by: 940790 on Jul 16, 2012 2:56 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2012
Added on Jul 16 2012
16 comments
13,072 views