Solved

How to find out which tables contain a certain column

  • 8 December 2022
  • 3 replies
  • 237 views

Badge +5

Hi!

As I said in the title, I need to know which table contains a specific column. Would the following query work for that? What should I put in the from-clause?

 

SELECT      COLUMN_NAME AS 'ColumnName', TABLE_NAME AS  'TableName'

FROM        

WHERE       COLUMN_NAME LIKE '%storage_instructions%'

ORDER BY    TableName

            ,ColumnName;

icon

Best answer by ashen_malaka_ranasinghe 8 December 2022, 09:57

View original

3 replies

Userlevel 7

You could try to use the view DICTIONARY_SYS_TAB_COLUMNS. You won’t find a column called “storage_instructions”, unless you use UPPER(). 

Userlevel 4
Badge +10

To find all tables with a particular column if you know the column name accurately:

select owner, table_name from all_tab_columns where upper(column_name) = upper('<name_of_the_column>');

 To find all tables with a particular column if you don't know the accurate column:

select owner,table_name from all_tab_columns where upper(column_name) like upper('%keyword%');
Badge +5

Thank you, I found the right table 👍

Reply