I want to distinguish between a view and table. Basically, I want to find all the tables which has a partic开发者_JAVA技巧ular column name.
select table_name from user_tab_columns x where column_name='STUDENTID';
The above query also returns views which have the same column. I tried using the following, however, I feel it take long time to run and return...
select table_name from user_tables where table_name in (select x.table_name from user_tab_columns x where x.column_name='PLAN_NAME');
any suggestions please.
I guess a join will be quicker than a subselect. Try this:
select c.table_name
from user_tab_columns c, user_tables t
where c.table_name = t.table_name
and c.column_name='STUDENTID';
精彩评论