oracle select all columns with table name code example

Example 1: oracle find all tables with column name

-- Oracle-specific
-- all_tab_columns is a magic table listing all columns from all tables
select table_name from all_tab_columns where column_name = 'PICK_COLUMN';

Example 2: oracle find all tables with column name

SELECT * FROM USER_TAB_COLUMNS WHERE COLUMN_NAME = 'MY_COLUMN'; -- Connected user
SELECT * FROM ALL_TAB_COLUMNS WHERE COLUMN_NAME = 'MY_COLUMN';	-- Other schemas
SELECT * FROM DBA_TAB_COLUMNS WHERE COLUMN_NAME = 'MY_COLUMN';	-- All tables

Tags:

Sql Example