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

Home -> Community -> Usenet -> c.d.o.server -> Re: Report for Extracting Primary and dependant Foreign Keys for a table.

Re: Report for Extracting Primary and dependant Foreign Keys for a table.

From: Doug Anderson <dathedba_at_mindspring.com>
Date: 1997/03/20
Message-ID: <5gs2tt$6nj@camel1.mindspring.com>#1/1

Andy Smith <andy.smith_at_citicorp.com> wrote:
>Does anyone wish to share a script they may have, to identify
>all Foreign keys for a particular Primary key.

I used to have a script sitting around but have misplaced it. I'll go looking for it again.

In the mean time this is what it did for the most part. Use the data dictionary views DBA_CONSTRAINTS and DBA_CONS_COLUMNS. The constraint_type will be 'R' for foreign-keys (don't ask why) and 'P' for primary-keys. You can build the correct statements to construct them again by using a MAX function combined with a DECODE on the POSITION column. I know I have that script around somewhere! Oh well, happy trails.

Received on Thu Mar 20 1997 - 00:00:00 CST

Original text of this message

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