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: Referenced Table in Dictionary?

Re: Referenced Table in Dictionary?

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Tue, 14 Sep 1999 16:23:30 +0200
Message-ID: <7rllqe$fht$1@oceanite.cybercable.fr>


First statement gives all the tables referenced by a given table, second one gives you all the tables that reference a given one.

select a.constraint_name, b.table_name from user_constraints b, user_constraints a

where a.table_name='<your table>'
  and b.owner = a.r_owner
  and b.constraint_name = a.r_constraint_name
  and a.constraint_type = 'R'

/

select b.table_name, b.constraint_name from user_constraints b, user_constraints a

where a.table_name='<your table>'
  and b.r_owner = a.owner
  and b.r_constraint_name = a.constraint_name
  and a.constraint_type = 'P'

/

Christian Dzimalle a écrit dans le message <37DE446C.DA7E7B12_at_uni-goettingen.de>...
>Hi,
>
>is it possible to find out the name of the table that is referenced by
>another table using
>the dictionary?
>
>take for instance:
>CREATE PERSON
>(...
> CNR constraint fk_company references COMPANY,
> ...
>)
>
>select * from user_constraints; or select * from user_cons_columns;
>will tell me the name 'PERSON' but what i need is the tablename
>'COMPANY'.
>
>Thanks in advance
>Cdzi
>
>P.S. is there an FAQ?
Received on Tue Sep 14 1999 - 09:23:30 CDT

Original text of this message

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