Home » SQL & PL/SQL » SQL & PL/SQL » FOREINKEY CONSTRAINT'S REFERENCE TABLE INFORMATION
FOREINKEY CONSTRAINT'S REFERENCE TABLE INFORMATION [message #116] Tue, 15 January 2002 04:28 Go to next message
Ayyappan pillai Sujith Ku
Messages: 6
Registered: November 2001
Junior Member
Hi Friends,
How will i get the information of a foreign key constraint's reference table name and associated columns. I did't get it from the views like user_constraints and user_cons_columns. Pls help me

Sujith
Re: FOREINKEY CONSTRAINT'S REFERENCE TABLE INFORMATION [message #119 is a reply to message #116] Tue, 15 January 2002 05:18 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
columns referenced
===================
select table_name,column_name from user_cons_columns where CONSTRAINT_NAME='EMP_FOREIGN_KEY';

table referenced
===================

select table_name from user_constraints
where constraint_name
=(select r_constraint_name
from user_constraints
where CONSTRAINT_NAME='EMP_FOREIGN_KEY');
Re: FOREINKEY CONSTRAINT'S REFERENCE TABLE INFORMATION [message #136 is a reply to message #116] Thu, 17 January 2002 03:34 Go to previous message
Ayyappan pillai Sujith Ku
Messages: 6
Registered: November 2001
Junior Member
Thak you Pradap for the timly help.

For the information abt the reference table and the related reference colums, the following query helped me.

SELECT TABLE_NAME,COLUMN_NAME FROM USER_CONS_COLUMNS WHERE CONSTRAINT_NAME =(SELECT R_CONSTRAINT_NAME FROM USER_CONSTRAINTS WHERE CONSTRAINT_NAME='XXX_FK')

Thanks
sujith
Previous Topic: Re: how to pass parameters dynamically
Next Topic: ERROR WHILE MANIPULATING A PL/SQL TABLE.
Goto Forum:
  


Current Time: Thu Apr 18 19:18:05 CDT 2024