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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting info on constraint from data dict. tables

Re: Getting info on constraint from data dict. tables

From: udaj <udaj_at_email.msn.com>
Date: Sun, 26 Sep 1999 22:12:44 -0400
Message-ID: <uprRX1IC$GA.302@cpmsnbbsa05>


HI again...
Hope this helps...

select cc.constraint_name "constraint", uc.r_constraint_name "foreign key",
cc.column_name
from sys.user_cons_columns cc, sys.user_constraints uc where uc.constraint_name = cc.constraint_name and uc.r_constraint_name is not null

<angelabr_at_my-deja.com> wrote in message news:7sfbu7$l7v$1_at_nnrp1.deja.com...
> Hi,
>
> Thanks for the help there; but what I really want to find out is: how
> do you find out the exact column of that primary key that is being
> referenced?
>
> Thanks again,
> Angela
>
> In article <ejUTdqeB$GA.309_at_cpmsnbbsa03>,
> "udaj" <udaj_at_email.msn.com> wrote:
> > hi
> > the column called r_constraint_name [in dba_constraints] gives u the
> name of
> > the constraint [primary key] which is being referred.
> >
> > viji
> >
> > <angelabr_at_my-deja.com> wrote in message
> news:7sdijb$blr$1_at_nnrp1.deja.com...
> > > Hi all,
> > >
> > > My problem is that I'm trying to find out the exact column that
> another
> > > is related to via a foreign key constraint.
> > >
> > > Table A Table B
> > > ---------- ----------
> > > column U -------> # column V
> > > column X -------> # column Y
> > > # column W column Z
> > >
> > > For example, Column X in Table A is a reference to Column Y in
> Table B,
> > > the primary key of Table B includes the column Y and the column V.
> By
> > > using the DBA_CONS_COLUMNS and DBA_CONSTRAINTS tables I can find out
> > > the column X (in table A) references the primary key of Table B ...
> BUT
> > > I don't know how I can determine that column X is only related to
> > > column Y (and not column V)! Any ideas?
> > >
> > > Thanks in advance,
> > > Angela
> > >
> > >
> > > Sent via Deja.com http://www.deja.com/
> > > Share what you know. Learn what you don't.
> >
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Sun Sep 26 1999 - 21:12:44 CDT

Original text of this message

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