0

I'm trying to find a table containing a column that I know the name to. Is there some way to do a table search using only the name of the column?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Phillip
  • 43
  • 1
  • 12

1 Answers1

0

In oracle

select * from user_tab_columns where column_name= '';
Zeus
  • 6,386
  • 6
  • 54
  • 89
  • Thank you. I never heard of `user_tab_columns` before, or `column_name`. I am a beginner. I tried running this line, but i wasn't sure why `column_name` does not work in it: `select table_name from all_tables where column_name = ' ';` Could you explain? – Phillip Oct 23 '15 at 15:39
  • @Phillip whch version of oracle are you using? `select * from all_tables` does not has column information. `All_tables` gives you the list of tables. `User_tab_columns` gives you all columns in your database – Zeus Oct 23 '15 at 16:08
  • try `select * from user_tab_columns where column_name= 'some_column';` – Zeus Oct 23 '15 at 16:11
  • I'm using Oracle 11g. The command you gave me just now runs fine, however it doesn't do what I hoped it would. When I specify the column name I'm searching for, t just displaces a bunch of empty column names. Maybe I could add a code that will allow it to display the name of the table alone itself. – Phillip Oct 23 '15 at 17:50