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: foreign key

RE: foreign key

From: Kevin Lange <kgel_at_ppoone.com>
Date: Fri, 01 Jun 2001 12:17:26 -0700
Message-ID: <F001.003187FE.20010601122822@fatcity.com>

This should work for you I think Harvinder. You provide an Owner and a Table Name and it will return to you the keys plus the name of the corresponding Table and Primary keys they are referenced to .

      SELECT  c.owner, c.table_name, c.constraint_name,
                c.r_constraint_name pkname,
                c.r_owner pkowner, r.table_name pktab,
                DECODE( c.status,'DISABLED',' DISABLE',' ') status,
                DECODE( c.delete_rule,
                        'CASCADE',' ON DELETE CASCADE ',
                        ' ') del_rule
        FROM    dba_constraints c,
                dba_constraints r
        WHERE   c.owner =  '&owner'
        AND     c.table_name = '&table'
        AND     c.constraint_type='R'
        AND     c.r_owner = r.owner
        AND     c.r_constraint_name = r.constraint_name

-----Original Message-----
Sent: Friday, June 01, 2001 1:23 PM
To: Multiple recipients of list ORACLE-L

Hi,

How to find out that a particular table is referenced by which other tables i.e..other tables having foreign key referncing this particular table..

Thanks
Harvinder
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Harvinder Singh
  INET: Harvinder.Singh_at_MetraTech.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).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Kevin Lange
  INET: kgel_at_ppoone.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 Fri Jun 01 2001 - 14:17:26 CDT

Original text of this message

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