Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE:How do I know the column name(s) from a FK name? FW: Foreign

RE:How do I know the column name(s) from a FK name? FW: Foreign

From: David Barbour <DBarbour_at_connectsouth.com>
Date: Wed, 4 Oct 2000 14:35:14 -0500
Message-Id: <10639.118510@fatcity.com>


Grabbed this off the list a while back. Credit due to the original author.

David A. Barbour
Oracle DBA - ConnectSouth
512-681-9438
dbarbour_at_connectsouth.com

-----Original Message-----
From: bosco_at_ibsplc.com [mailto:bosco_at_ibsplc.com] Sent: Tuesday, July 18, 2000 4:39 AM
To: Multiple recipients of list ORACLE-L Subject: Re: Foreign Key constraint Script

Hello Ashish, Hello All,

Please find here a script which would show you the foreign keys on a table .It shows the other tables which are referencing this table

select c.TABLE_NAME, c.CONSTRAINT_NAME, c.R_CONSTRAINT_NAME, rc.TABLE_NAME,

       substr(col.COLUMN_NAME,1,30)
from user_constraints c, user_cons_columns col, user_constraints rc where c.TABLE_NAME like upper('&TableName')   and rc.CONSTRAINT_NAME = c.R_CONSTRAINT_NAME   and col.CONSTRAINT_NAME = c.CONSTRAINT_NAME order by c.TABLE_NAME, c.CONSTRAINT_NAME, col.POSITION;

Pass the table name as a parameter
Have fun,
Bosco

Hi All,
Does any one have any script that will tell me a Table has been referenced (foreign key) in how many other tables. I had a tough time droping a table since
it was refered by so many other table.
I tried looking user_constraints but it doesn't give you information about primary table.
TIA.



Ashish
Toronto, Canada
-- 
Author: 
  INET: bosco_at_ibsplc.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 - 14:35:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US