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

Home -> Community -> Usenet -> c.d.o.misc -> Renaming primary and /or unique keys

Renaming primary and /or unique keys

From: Jens Lenge <spampot_at_gmx.net>
Date: 13 Jul 2006 11:59:42 -0700
Message-ID: <1152817182.142407.181690@h48g2000cwc.googlegroups.com>


Hello world,

I discovered a strange behavior when renaming primary and/or unique keys of an existing table in Oracle 9i (or maybe it's rather normal than strange, and I am simply doing something wrong).

Normally, creating a primary key or unique key constraint will automatically also create an index with the same name and reference.

I have tried to rename an existing primary key and an existing unique key like that:

   alter table mytable rename constraint pk111 to pk_mytable_id;    alter table mytable rename constraint uk222 to uk_mytable_name;

While the two CONSTRAINTS now do have the new names, the corresponding INDICES still have the old names.

How can I rename both the constraints AND the corrsponding indices?

I cannot simply rename the indices to the new names (as the destination name is already used), and I also cannot delete them (as they enforce a primary resp. unique key). So how to go?

Jens Received on Thu Jul 13 2006 - 13:59:42 CDT

Original text of this message

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