Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: reverse engineering an oracle schema
Foreign keys point not to tables but to primary keys.
To find out what table a foreign key points to, you got to travel
select fk.constraint_name || ' points to '|| pk.table_name from dba_constraints fk,
dba_constraints pk
where fk.constraint_type = 'R'
and pk.constraint_name = fk.r_constraint_name
and pk.owner = fk.r_owner
Regards,
Marc Mazerolle
InforMaze Technologies
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
Received on Wed Feb 24 1999 - 15:43:19 CST