Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> 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. Received on Wed Oct 04 2000 - 13:51:00 CDT