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

Home -> Community -> Usenet -> c.d.o.server -> Re: Foreign keys.

Re: Foreign keys.

From: <oratune_at_aol.com>
Date: Tue, 10 Oct 2000 19:02:43 GMT
Message-ID: <8rvp4e$j19$1@nnrp1.deja.com>

In article <8rvob0$i50$1_at_nnrp1.deja.com>,   vdolt_at_my-deja.com wrote:
> I am trying to delete a record from the table. Other tables have
> foreign keys on that table, which prevents me from deleting original
> record. Is there a query I can run to uncover all the foreign key on
> that table?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Try this:

 select c.table_name, c.constraint_name, r.table_name ref_table_name  from user_constraints c, user_constraints r  where r.constraint_name = c.r_constraint_name  and r.table_name = '<table_name>'

This will give you the table names and the foreign keys referencing your parent table. Put the parent table name in place of <table_name>.

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Oct 10 2000 - 14:02:43 CDT

Original text of this message

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