Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: reverse engineering an oracle schema
Try this one:
select c1.table_name
, c1.r_constraint_name
, c2.table_name
from dba_constraints c1, dba_constraints c2
where c1.constraint_type = 'R'
and c2.constraint_name = c1.r_constraint_name and c2.owner = c1.r_owner and c2.constraint_type = 'P' /*this shouldn't be necessary, asconstraintnames are unique */
This should work without problem
Hth,
Sybrand Bakker, Oracle DBA
On Wed, 24 Feb 1999 21:16:33 GMT, kal121_at_yahoo.com wrote:
>Hello all,
>
>I know that there are probably lots of really great tools out there that can
>already do this for me, but it's not in the budget and I already started
>writing my own program to reverse engineer my schema (tables and indexes
>only)
>
>The problem is, I can't find a view anywhere in the data dictionary that
>gives me foreign keys AS WELL AS the table that the foreign key is
>referencing. I've tried dba_constraints, dba_cons_columns, etc. The
>"table_name" column is simply the name of the table where the foreign key
>resides, NOT the table that the foreign key is REFERENCING. I refuse to
>believe this information does not exist. Can anybody help me?
>
>Thanks.
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Sybrand Bakker, Oracle DBA Received on Wed Feb 24 1999 - 16:04:56 CST
![]() |
![]() |