-- #############################################################################################
--
-- %Purpose: Anzeige der Foreign-Key Referenzen von/zu Oracle Tabellen 
--
-- Use:      Needs Oracle DBA Access
--
-- #############################################################################################
--
spool obj_dependencies.lst
set feed off
set pagesize 10000
ttitle off

break on owner on referenced_type on referenced_name on type skip 1
column datum new_value datum noprint
column owner format A10 heading 'Object|Owner'
column name format A24 heading 'Object|Name'
column type format A10 heading 'Object|Type'
column referenced_name format A22 heading 'Parent|Name'
column referenced_type format A10 heading 'Parent|Type'

ttitle center 'Dependencies to/from all Objects' skip 2

select  to_char(sysdate, 'MM/DD/YY') datum,
    substr(owner,1,10) owner,
    substr(referenced_type,1,10) referenced_type,
    substr(referenced_name,1,22) referenced_name,
    substr(type,1,10) type,
    substr(name,1,24) name
from dba_dependencies
where owner not in ('SYS','SYSTEM')
and referenced_type not in ('NON-EXISTENT')
order by 1,2,3,4,5,6;

spool off;
exit;
