How to pass table name dynamic in sql
943793Jul 16 2012 — edited Jul 20 2012Hi
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