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: Foreign Key in Oracle Database

Re: Foreign Key in Oracle Database

From: Van Messner <vmessner_at_bestweb.net>
Date: 2000/07/28
Message-ID: <Vkkg5.2639$_K3.191231@newshog.newsread.com>#1/1

Here's an extra one that finds the foreign keys pointing to your table:

column fowner heading 'Owner Of |Table With|Foreign Key' format a11 column ftable heading ' Name Of | Table With| Foreign Key' format a16 column fconname heading ' FK Name ' format a22 column fdel heading 'Delete|Rule' format a10 column fref heading 'Constraint in|Parent Table|Pointed to by FK' format a22 column fstatus heading 'FK Status' format a8 TTITLE ' FOREIGN KEYS THAT POINT TO THIS TABLE ' SELECT

  frn.owner fowner,
  frn.table_name ftable,
  frn.constraint_name fconname,
  frn.delete_rule fdel,
  frn.r_constraint_name fref,
  frn.status fstatus

FROM
  dba_constraints par,
  dba_constraints frn
WHERE
  par.table_name = UPPER('&tname')
  and par.owner = UPPER('&qowner')
  and par.constraint_name = frn.r_constraint_name ;

Van

"Reza" <reza_at_digital-dispatch.co.uk> wrote in message news:964777760.19253.0.nnrp-04.d4f07aaa_at_news.demon.co.uk...
> Type something like
> select *
> from dba_constraints
> where CONSTRAINT_TYPE='R'
> and elaborate on that is you need to find which PK it is refereing to by
> self-joining it on R_CONSTRAINT_NAME column to itself.
> Regards
> "¤õª¢ª¢" <cwwong_at_se.cuhk.edu.hk> wrote in message
> news:8lrj3e$fod$1_at_justice.csc.cuhk.edu.hk...
> >
> >
> > Dear all,
> > Would you like to tell me that how to find out a foreign keys of a
 table,
> > which database table(s) I need to search?
> >
> > Thank you for your attention!
> > Regards,
> >
> > Nelson Wong
> > Research Assistant
> > Systems Engineering & Engineering Management,
> > CUHK
> >
> >
> >
>
>
Received on Fri Jul 28 2000 - 00:00:00 CDT

Original text of this message

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