Home » RDBMS Server » Server Administration » Disabling primary Key
Disabling primary Key [message #372440] Tue, 13 February 2001 16:16 Go to next message
Ken
Messages: 50
Registered: April 1998
Member
Hi there,
I've a primary key like MY_TAB.MY_ID, i need to drop this MY_TAB table, but MY_ID is a foreign key to another table.

To disable/drop the primary key, I need to first disable the foreign key references and then drop it.

Does anyone know which oracle table tells me what the foreign table is ?

Thanks,
Ken.
Re: Disabling primary Key [message #372443 is a reply to message #372440] Tue, 13 February 2001 18:02 Go to previous messageGo to next message
Venkat
Messages: 110
Registered: February 2001
Senior Member
login to that user.. and
run this select and it will give u the tables involved with ur dropping primary key ..

select table_name
from user_constraints where
r_constraint_name = 'ur constraint name'
Re: Disabling primary Key [message #372444 is a reply to message #372440] Tue, 13 February 2001 18:50 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
SELECT b1.table_name, c1.column_name, c1.position, b1.constraint_name, b1.owner,
b1.delete_rule,
DECODE (b1.constraint_type, 'R', 'Referential', 'P', 'Primary', b1.constraint_type)
FROM all_constraints b1, all_cons_columns c1
WHERE b1.r_constraint_name = c1.constraint_name
AND b1.r_owner = c1.owner
AND c1.table_name = 'MY_TABLENAME'
ORDER BY b1.owner, b1.table_name, c1.position

drop table XYZ cascade constraints;
Previous Topic: explain plan
Next Topic: help required in a sql query (URGENT)
Goto Forum:
  


Current Time: Wed May 15 15:15:12 CDT 2024