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!

Query to find relevant Table name

Chandan.RattanJan 16 2013 — edited Jan 16 2013
Hi i need a SQL query which should return me relevant table names. i.e. if there is table 'EMP' , then query should give table names with below result:



EMP

EMP_1

EMP_2

EMP_3

EMP_4



i.e. All tables which is starting with EMP (No Hardcoding of table, It should be dynamic way).I know we can achieve through SELECT * FROM USER_OBJECTS WHERE OBJECT_NAME LIKE 'EMP%'.

But here object_name i will passing dynamically.



Actually my main purpose is to create backup tables i.e. EMP is main table and EMP_1,EMP_2,EMP_3 .. EMP_100 is backup table.Now whenever i am making the any changes in EMP table, then i should take the backup of exiting EMP table and backup data should go to EMP_101 (as last table with sequence is EMP_100).



Any idea in SQL , PL/SQL i would appreciate .



Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2013
Added on Jan 16 2013
3 comments
2,094 views