Is there any way that I can find out what tables uses columns from another table as their thier foreign keys?(i.e. is primary key foreign key relation ship)
Can anybody paste a script that does that?
Printable View
Is there any way that I can find out what tables uses columns from another table as their thier foreign keys?(i.e. is primary key foreign key relation ship)
Can anybody paste a script that does that?
I use:
select p.TABLE_NAME PARENT_TABLE,
p.CONSTRAINT_NAME PK,
c.TABLE_NAME CHILD_TABLE,
c.CONSTRAINT_NAME FK
from user_constraints c, user_constraints p
where c.CONSTRAINT_TYPE = 'R'
and c.R_CONSTRAINT_NAME = p.CONSTRAINT_NAME
and c.TABLE_NAME like upper('%&table_name%')
Hope it helps
thank you sysdba. It helped