Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple question re Foreign key info
Hi,
One way is to select from USER_CONSTRAINTS (or DBA_CONSTRAINTS if it's
appropriate and if you have
access to it) like this for example:
SQL> select constraint_name,table_name,r_constraint_name
2 from user_constraints
3 where table_name in ('EMP','DEPT') AND
4 CONSTRAINT_TYPE = 'R';
CONSTRAINT_NAME TABLE_NAMER_CONSTRAINT_NAME
------------------------------ ------------------------------ -------------- ---- EMP_SELF_KEY EMP EMP_PRIMARY_KEY EMP_FOREIGN_KEY EMP
I hope this helps,
Steve
"Twin" <tweeting100_at_hotmail.com> wrote in message
news:997798648.13978_at_ernani.logica.co.uk...
> Hi all,
>
> I've always wanted to know how to do this, but no-one seems to be able to
> tell me how.
>
> I have three tables (tablea, tableb and tablec) related in someway to each
> via foreign keys. I don't have the script to see the relationships, so
I'd
> like to know which system table contains the foreign key relationships (if
> any).
>
> Any ideas ?
>
> Thanks.
>
>
Received on Tue Aug 14 2001 - 09:42:54 CDT
![]() |
![]() |