Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Renaming primary and /or unique keys
Jens Lenge (spampot_at_gmx.net) wrote:
: 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?
you could disable the constraint first and then change things and then reanable the constraint afterwards.
$0.10 Received on Thu Jul 13 2006 - 15:13:09 CDT
![]() |
![]() |