Oracle query which tables a field exists in

The sql statements searched online are generally:

select TABLE_NAME  
 from user_tab_columns  
 where COLUMN_NAME='CNAME'

 However , when querying which tables a field has appeared in the user_tab_columns table, the view will also be found, and an inexplicable string of characters will be found, which does not match the requirements.

 

After that, I got to know another table: user_tables, which can query which tables the user has.

 

Use the inner join of user_tab_columns and user_tables to query which tables a field exists in.

select t.table_name
from user_tables t  
inner join  (
  select TABLE_NAME  
  from user_tab_columns  
  where COLUMN_NAME='CNAME'
) b on t.TABLE_NAME=b.TABLE_NAME;

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326823475&siteId=291194637