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: Direct and indirect foreign key relationships in SQL or Pl/Sql

Re: Direct and indirect foreign key relationships in SQL or Pl/Sql

From: Ruth Gramolini <rgramolini_at_tax.state.vt.us>
Date: Thu, 19 Dec 2002 07:39:40 -0800
Message-ID: <F001.0051E47E.20021219073940@fatcity.com>


Here is a script that I got from on of the lists. It should do what you want.
Ruth

select a.constraint_name, a.r_constraint_name, a.table_name, b.table_name  from dba_constraints a,

        dba_constraints b
where a.owner='YOUR_OWNER'
and a.R_CONSTRAINT_NAME is not null
and a.R_constraint_name=b.constraint_name order by a.table_name;

> Hi all,
>
> How do I find out the direct and indirect foreign key relationships?
> Say, for example there are four tables A, B, C and D of which A is the
> parent table and B, C and D are child tables. Say B and C are related to
A
> directly and D is related to A through C. How do I find out this indirect
> relationship apart from the direct relationships? Any help in this regard
> is very much appreciated.
>
> Thanks and Regards,
>
> Ranganath
>
>
> WARNING: The information in this message is confidential and may be
legally
> privileged. It is intended solely for the addressee. Access to this
message
> by anyone else is unauthorised. If you are not the intended recipient,
any
> disclosure, copying, or distribution of the message, or any action or
> omission taken by you in reliance on it, is prohibited and may be
unlawful.
> Please immediately contact the sender if you have received this message in
> error. Thank you.
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Krishnaswamy, Ranganath
> INET: Ranganath.Krishnaswamy_at_blr.hpsglobal.com
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> 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.net
-- 
Author: Ruth Gramolini
  INET: rgramolini_at_tax.state.vt.us

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Thu Dec 19 2002 - 09:39:40 CST

Original text of this message

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