当前位置: 代码迷 >> Oracle管理 >> ,小弟我有一张表 ,怎么知道哪些表依赖这张表 ,多谢
  详细解决方案

,小弟我有一张表 ,怎么知道哪些表依赖这张表 ,多谢

热度:66   发布时间:2016-04-24 05:21:37.0
请教大家 ,我有一张表 ,如何知道哪些表依赖这张表 ,谢谢
请教大家 ,我有一张表 ,如何知道哪些表依赖这张表 ,谢谢

------解决方案--------------------
参考

SQL code
select u1.CONSTRAINT_NAME, u1.TABLE_NAME as table_, u2.TABLE_NAME as reference_   from user_constraints u1, user_constraints u2   where    u1.constraint_type='R' and  u1.R_CONSTRAINT_NAME = u2.CONSTRAINT_NAME and  u2.table_name='target_table_name'
------解决方案--------------------
探讨

参考

SQL code

select u1.CONSTRAINT_NAME, u1.TABLE_NAME as table_, u2.TABLE_NAME as reference_
from user_constraints u1, user_constraints u2
where
u1.constraint_type='R' and
u1.R_CONSTR……

------解决方案--------------------
SQL code
-- 查询引用父表的所有子表selectc.owner||'.'||c.table_name child_table, c.constraint_name child_constraint_name,(select wm_concat(column_name) from dba_cons_columns  where owner=c.owner and constraint_name=c.constraint_name) child_columns,p.owner||'.'||p.table_name parent_table, p.constraint_name parent_constraint_name,(select wm_concat(column_name) from dba_cons_columns  where owner=p.owner and constraint_name=p.constraint_name) parent_columnsfrom dba_constraints c,dba_constraints pwhere p.owner=c.r_owner and p.constraint_name=c.r_constraint_nameand p.owner='&parent_owner' and p.table_name='&parent_table';
  相关解决方案