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: Referential constraints

Re: Referential constraints

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Wed, 30 Aug 2000 08:37:01 +0200
Message-ID: <8oia4v$386$1@s1.read.news.oleane.net>

Here's a script that gives the foreign of one of your table (parameter &1).

Break On fk Skip 1 On reftab On pk

Spool FKList

Select cons.constraint_name fk,

       col.column_name fkcol,
       cons2.table_name reftab,
       cons2.constraint_name pk,
       col2.column_name pkcol
from user_cons_columns col2, user_cons_columns col,
     user_constraints cons2, user_constraints cons
where col2.owner = cons.r_owner

  and col2.constraint_name = cons.r_constraint_name   and col2.position = col.position
  and cons2.owner = cons.r_owner
  and cons2.constraint_name = cons.r_constraint_name   and col.owner = cons.owner
  and col.constraint_name = cons.constraint_name
  and cons.owner = user
  and cons.table_name = upper('&1')
  and cons.constraint_type = 'R'

/

Spool off

---------------------- FKList.sql -------------------------

--
Have a nice day
Michel


Johan den Boer <jj.den.boer_at_hccnet.nl> a écrit dans le message : 39ABD6DD.C9DEBF09_at_hccnet.nl...

> Hi,
>
> I am looking for a script which can display the referential
> constraints between tables and their columns.
> Does anyone know a good website to get such scripts ?
> --
> Regards
>
> Johan den Boer
> email : jj.den.boer_at_hccnet.nl
Received on Wed Aug 30 2000 - 01:37:01 CDT

Original text of this message

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