Solved

dynamic query

Posted on 2011-03-07
3
244 Views
Last Modified: 2012-06-21
What is the best way to replace the two table names with the 700 tables names in my schema?

select table_name from user_tables where table_name in ('TIOR','TIIN')
0
Comment
Question by:msimons4
3 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 167 total points
ID: 35060638
Please try:

SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER = '<< your schema name >>'
0
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 166 total points
ID: 35061544
What do you mean 'replace'?  Are you wanting to physically rename the tables?

If you do, what about all the constraints/indexes/foreign keys on them?
0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 167 total points
ID: 35063339
if you are interested only in your tables, then you can query USER_TABLES :

SELECT TABLE_NAME FROM USER_TABLES ;

if you are interested in all your tables + any tables on which you have got privileges, then use the below :

select table_name from ALL_tables ;

select table_name from ALL_tables where OWNER = 'SCOTT' ; -- to find only those which are owned by SCOTT user by you have privileges on them. change SCOTT to your user name accordingly.

If you are interested to find all table names in the database, then you can query DBA_TABLES

select table_name from DBA_tables where owner ='TEST_USER';  -- change test_user to actual user name

select table_name from ALL_tables ;
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now