Home » SQL & PL/SQL » SQL & PL/SQL » Rename primary key
Rename primary key [message #40656] Mon, 28 October 2002 09:01 Go to next message
Obede F. Souto
Messages: 5
Registered: June 2002
Junior Member
Is it possible to rename primary key or drop it an create with another name in a table with data?
Oracle 8i (8.1.7)
Re: Rename primary key [message #40658 is a reply to message #40656] Mon, 28 October 2002 09:39 Go to previous messageGo to next message
Rick Cale
Messages: 111
Registered: February 2002
Senior Member
Try

ALTER INDEX index_name RENAME TO new_index_name;
Re: Rename primary key [message #40660 is a reply to message #40656] Mon, 28 October 2002 09:56 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
No, you can't rename a constraint in 8.1.7 - you can in 9i (R2?). Disable the foreign key constraints pointing to that PK and re-create the PK with the new name. Chances are that the underlying index belonging to the PK will be dropped in your case (it's not always true that it'll happen), so be sure to look at the existing storage paramaters of the index if you want it created with the same details. Re-enable the FK's
Previous Topic: ORA-12801, ORA-27062
Next Topic: SHAHNAZ ASKs HOW TO install dev 6i on xp
Goto Forum:
  


Current Time: Sun May 05 13:16:36 CDT 2024