Thursday, February 09, 2012

All the Oracle dictionary columns and which tables they occur in.

create a function which returns the table_name separated by ":"
--
create or replace function ret_tables(i_column_name in varchar2)
return clob
as
cursor c1
is
select table_name from dict_columns where column_name = i_column_name;
str clob;
begin
str := '';
for c1rec in c1 loop
str := str||c1rec.table_name||' : ';
end loop;
return str;
end;
/
--
set lines 2200 trimspool on
col tab_list for a2000 word_wrapped
select col_name, ret_tables(col_name) tab_list from (select distinct column_name col_name from dict_columns order by column_name);
--

select col_name, ret_tables(col_name) tab_list from (select distinct column_name col_name from dict_columns order by column_name);

0 Comments:

Post a Comment

<< Home