A simple select query to find child table of a particular table:
SELECT parent.table_name AS "PARENT TABLE", child.table_name AS "CHILD TABLE", child.R_CONSTRAINT_NAME, cols.column_name
FROM user_constraints parent, user_constraints child, user_cons_columns cols
WHERE parent.constraint_type = 'P' AND
child.constraint_name = cols.constraint_name and
parent.CONSTRAINT_NAME = child.R_CONSTRAINT_NAME AND
child.CONSTRAINT_TYPE = 'R' AND
parent.table_name = <table_name>
No comments:
Post a Comment