Search This Blog

Tuesday, February 1, 2011

Constraints querry

select child.owner||'.'||child.table_name||'.'||child.column_name||' must exist in '||
parent.owner||'.'||parent.table_name||'.'||parent.column_name
from
all_cons_columns child
, all_cons_columns parent
, all_constraints c
where c.owner='T2IMGDEV'
and c.constraint_name='EMPR_ID_FK'
and child.owner=c.owner
and child.constraint_name=c.constraint_name
and parent.owner=c.r_owner
and parent.constraint_name=c.r_constraint_name
and child.position=parent.position
/

eg output:
CHILD.OWNER||'.'||CHILD.TABLE_NAME||'.'||CHILD.COLUMN_NAME||'MUSTEXISTIN'||PAREN
--------------------------------------------------------------------------------
T2IMGDEV.IMAGES.EMPR_ID must exist in T2MIFULL3.EMPLOYERS.ID

No comments:

Post a Comment

Transportable tablespace refresh

  1.check tablespace for the user which need to refresh -------------------------------------------------------------------  SQL> select ...