|
Re: To check the refrential integrity between two tables? [message #372189 is a reply to message #372185] |
Thu, 18 January 2001 08:54 |
Suresh Vemulapalli
Messages: 624 Registered: August 2000
|
Senior Member |
|
|
Hi,
To find referential integrity columns
select a.column_name,c.table_name "ref table",c.column_name "ref column"
from user_cons_columns a,user_cons_columns c,user_constraints b
where a.constraint_name=b.constraint_name
and a.table_name=b.table_name and
a.table_name='YOURTABLENAME' and b.constraint_type='R'
and b.r_constraint_name=c.constraint_name
to Find primary key columns:
select a.column_name
from user_cons_columns a,user_constraints b
where a.constraint_name=b.constraint_name
and a.table_name=b.table_name and
a.table_name='YOURTABLENAME' and b.constraint_type='P'
Suresh
|
|
|
|