From: oratune@aol.com
Newsgroups: comp.databases.oracle.server
Subject: Re: Foreign keys.
Date: Tue, 10 Oct 2000 19:02:43 GMT
Organization: Deja.com - Before you buy.
Lines: 28
Message-ID: <8rvp4e$j19$1@nnrp1.deja.com>
References: <8rvob0$i50$1@nnrp1.deja.com>
NNTP-Posting-Host: 38.193.42.5
X-Article-Creation-Date: Tue Oct 10 19:02:43 2000 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
X-Http-Proxy: 1.1 x56.deja.com:80 (Squid/1.1.22) for client 38.193.42.5
X-MyDeja-Info: XMYDJUIDddf_dba


In article <8rvob0$i50$1@nnrp1.deja.com>,
  vdolt@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.

