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

Home -> Community -> Usenet -> c.d.o.tools -> Re: How to retrieve relationship and FKs?

Re: How to retrieve relationship and FKs?

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Tue, 13 Feb 2001 18:09:30 +0100
Message-ID: <96bpoa$m7v$1@s1.read.news.oleane.net>

dba_constraints gives you the primary and foreign keys of all the tables.

v734> desc dba_constraints

 Name                            Null?    Type
 ------------------------------- -------- ----
 OWNER                           NOT NULL VARCHAR2(30)
 CONSTRAINT_NAME                 NOT NULL VARCHAR2(30)
 CONSTRAINT_TYPE                          VARCHAR2(1)
 TABLE_NAME                      NOT NULL VARCHAR2(30)
 SEARCH_CONDITION                         LONG
 R_OWNER                                  VARCHAR2(30)
 R_CONSTRAINT_NAME                        VARCHAR2(30)
 DELETE_RULE                              VARCHAR2(9)
 STATUS                                   VARCHAR2(8)

constraint_type is 'P' for a primary key and 'R' for a foreign key. For the latter r_constraint_name gives you the primary key referenced.

--
Have a nice day
Michel


"Bernd Maierhofer" <Bernd.Maierhofer_at_dato.at> a écrit dans le message news:
sOdi6.107217$1C6.3763701_at_news.chello.at...

> Hi and thanks in advance!
>
> Given Table A, how do I retrieve the dependent tables along with the
> relationship and the foreign keys?
> On the other hand, how do I retrieve the parent tables along with the
> relations?
>
> --
>
> Bernd Maierhofer
>
> dato Denkwerkzeuge
> Bernd.Maierhofer_at_dato.at
>
> Please: No private mail unless explicitly invited.
>
>
Received on Tue Feb 13 2001 - 11:09:30 CST

Original text of this message

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