Link to home
Start Free TrialLog in
Avatar of Natavia Finnie
Natavia FinnieFlag for United States of America

asked on

Oracle SQL - Select all table names from all schemas

I would like to select ALL the table names where employer_code exist and data_precision from all schemas  in a database.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Try something like:

select owner, table_name, column_name from dba_tab_columns where column_name in ('EMPLOYER_CODE','DATA_PRECISION');

You'll need DBA level access.  If you don't have it, try all_tab_columns but you will miss tables you don't have permissions to see.
slightwv's solution would give you tables that have at least one of the columns.

If the table needs to have both columns, try this:
SELECT owner, 
       table_name 
FROM   dba_tab_columns 
WHERE  column_name IN ( 'EMPLOYER_CODE', 'DATA_PRECISION' ) 
GROUP  BY owner, 
          table_name 
HAVING Count(1) > 1 

Open in new window

Avatar of Natavia Finnie

ASKER

'DATA_PRECISION' is an attribute like Table_name of the tables which gives you the column length. I need the data_precision of the "Employer_code" column where ever employer_code exist
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks all