Home » SQL & PL/SQL » SQL & PL/SQL » Foreign key references
Foreign key references [message #8657] Wed, 17 September 2003 10:58 Go to next message
Mark
Messages: 284
Registered: July 1998
Senior Member
I need to drop a table, but it sends me a message that other tables reference my table.
What Data dictionary view can I query to find all tables and their foreign keys which reference my table ? ALL_DEPENDENCIES lists only packages and procedures.

Thanks
Re: Foreign key references [message #8660 is a reply to message #8657] Wed, 17 September 2003 13:06 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
select b1.owner, b1.table_name, b1.constraint_name, c1.column_name, c1.position, 
       b1.constraint_name, b1.delete_rule 
  from all_constraints b1, all_cons_columns c1 
 where c1.table_name = :tabname
   and c1.owner = :ownname
   and b1.r_owner = c1.owner
   and b1.r_constraint_name = c1.constraint_name
   and b1.constraint_type = 'R' 
 order by b1.owner, b1.table_name, b1.constraint_name, c1.position;
Previous Topic: the sql query to find out the valid userids for logging into a server??
Next Topic: Sorting ip addresses
Goto Forum:
  


Current Time: Tue Apr 23 09:52:14 CDT 2024