Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: How do I know the column name(s) from a FK name?
user_cons_columns has the information you are looking for.
-----Original Message-----
From: Guang Mei [mailto:zlmei_at_hotmail.com]
Sent: Wednesday, October 04, 2000 3:56 PM
To: Multiple recipients of list ORACLE-L
Subject: How do I know the column name(s) from a FK name?
Hi:
Is there any way to query the data dictionary to get the columns from a FK name?
For example, the following query says there are three foreign keys
constraints in table 'HPXPRODUCT' that point to a primary key called
'PKHPXUOMCODE' in another table. I would like to find which column (in
'HPXPRODUCT') is used for which FK by query the data dictionary. How do I do
it?
TIA.
SQLWKS> SELECT TABLE_NAME , 2> CONSTRAINT_NAME 3> FROM USER_CONSTRAINTS 4> WHERE TABLE_NAME = upper('HPXPRODUCT') 5> AND CONSTRAINT_TYPE ='R' 6> AND R_CONSTRAINT_NAME = 'PKHPXUOMCODE'; TABLE_NAME CONSTRAINT_NAME ------------------------------ ------------------------------ HPXPRODUCT FK_PROD_UOMCODE3 HPXPRODUCT FK_HPXUOMCODE_HPXPRODUCT1 HPXPRODUCT FK_HPXUOMCODE_HPXPRODUCT2 _________________________________________________________________________Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at http://profiles.msn.com.
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Guang Mei INET: zlmei_at_hotmail.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Oct 04 2000 - 16:54:49 CDT