--主表共被哪些外键依赖
SELECT CONSTRAINT_NAME,CONSTRAINT_TYPE,OWNER,TABLE_NAME FROM all_constraints
START WITH TABLE_name='T_EMP_CDE' AND CONSTRAINT_TYPE='P'
CONNECT BY PRIOR CONSTRAINT_NAME=r_CONSTRAINT_NAME;
--从上到下,遍历某对象依赖关系
select name,type,REFERENCED_OWNER refowner,lpad(' ',8*(level-0))||REFERENCED_NAME refname,REFERENCED_TYPE reftype from all_DEPENDENCIES
where name <> referenced_name
and referenced_owner <> 'SYS' AND referenced_type <> 'NON-EXISTENT'
and referenced_name not in ('DUAL', 'DBMS_OUTPUT','STANDARD')
start with name='PKG1'
connect by prior REFERENCED_NAME=NAME
--从下到上至根,遍历某对象被依赖关系
select REFERENCED_NAME refname,REFERENCED_TYPE reftype,owner,lpad(' ',8*(level-1))||NAME name,type from all_DEPENDENCIES
where name <> referenced_name
and referenced_owner <> 'SYS' AND referenced_type <> 'NON-EXISTENT'
and referenced_name not in ('DUAL', 'DBMS_OUTPUT','STANDARD')
start with REFERENCED_name='DEPT'
connect by prior NAME=REFERENCED_NAME
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15357/viewspace-1024351/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15357/viewspace-1024351/