Reputation: 193
If I know the names of every column of a table but not the name of the table, how do I find the name of the table I need?
Upvotes: 10
Views: 63426
Reputation: 1
select * from all_updatable_columns where column_name like 'reqd col name';
Upvotes: -4
Reputation: 3533
Based on @Roobie's solution, the code below searches in all schemas you have access to, in case the table is not in your own schema. Also added case-insensitive matching.
SELECT owner, table_name
FROM all_tab_columns
WHERE UPPER(column_name) = UPPER('MYCOL');
Upvotes: 15
Reputation: 1396
Try this (one known column):
CREATE TABLE mytab(mycol VARCHAR2(30 CHAR));
SELECT table_name FROM user_tab_columns WHERE column_name='MYCOL';
Note MYCOL
is in upper case in column_name='MYCOL'
;
Cheers!
Upvotes: 10