Home » RDBMS Server » Server Administration » To check the refrential integrity between two tables?
To check the refrential integrity between two tables? [message #372185] Thu, 18 January 2001 01:55 Go to next message
Sajit Nair
Messages: 6
Registered: January 2001
Junior Member
Is there any view which will help me in checking the existing refrential integrity between two tables?

And also to check the Primary key of that tables?
Re: To check the refrential integrity between two tables? [message #372189 is a reply to message #372185] Thu, 18 January 2001 08:54 Go to previous messageGo to next message
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
Re: To check the refrential integrity between two tables? [message #372211 is a reply to message #372185] Thu, 18 January 2001 21:42 Go to previous message
Sajit Nair
Messages: 6
Registered: January 2001
Junior Member
Hi Suresh!

Thanks a Lot.
Previous Topic: java sql Timestamp and Oracle Date
Next Topic: Parameter Question
Goto Forum:
  


Current Time: Thu May 23 00:18:59 CDT 2024