Re: [Q] Foreign Keys

From: Thomas Keul <tk_at_ivu-berlin.de>
Date: 24 Jan 1995 08:15:15 GMT
Message-ID: <3g2cuj$e9u_at_ivu.ivu-berlin.de>


Byron Pearce (bpearc1_at_abacus.tis.tandy.com) wrote:
: I am trying to write a utility that will generate the CREATE script
: for all of the tables, views, indexes, etc. within the database. I
: have run into a problem that I am seeking some assistance on:
 

: All of my information is coming from the "DBA" views. I am trying
: to declare out-of-line constraints for each table, and this works
: fine for all constraints except for FOREIGN KEY.
 

: I know that the table name and the name of the foreign key constraint
: are kept in the R_OWNER R_CONSTRAINT_NAME columns, but where is the
: name of the column on the referenced table that the FOREIGN KEY is
: referencing?
 

: I would appreciate any assistance in this matter.
 

: Thanks!

Try:
select * from dba_cons_columns where constraint_name in (select R_constraint_name from dba_constraints where  constraint_type = 'R')

please optimize yourself

--
--------------------------------------------------------------------
Thomas Keul, IVU GmbH                               tk_at_ivu-berlin.de
Bundesallee 129                                 tel +49 30 850006 91
12161 Berlin, Germany                           fax +49 30 850006 86
Received on Tue Jan 24 1995 - 09:15:15 CET

Original text of this message