An ORA-00955 exception occurred when adding a field to the primary key.

Source: Internet
Author: User

An ora-00955 error occurred when adding a field to the primary key

Add an id2 field to mytable and make it one of the primary keys. The original primary key name is mytable_pk and the field is (id). follow these steps:

1. Delete the primary key:

Alter table mytable drop constraint mytable_pk cascade;

2. Add Fields

Alter table mytable add id2 varchar2 (6 );

3. Set initial values of new fields

Update mytable set id2 = 'sx ';

4. Change the new field to non-empty.

Alter table mytable modify id2 not null;

5. Add primary key constraints

Alter table mytable add constraint mytable_PK primary key (id2, id );

ERROR is located in row 1st:

ORA-00955: name used by existing object

Solution:

Because the original table may have an index of the same name, execute the following statement:

Drop index mytable_pk;

Run again

Alter table mytable add constraint mytable_PK primary key (id2, id );

ORA-01172, ORA-01151 error handling

ORA-00600 [2662] troubleshooting

Troubleshooting for ORA-01078 and LRM-00109

Notes on ORA-00471 Processing Methods

ORA-00314, redolog corruption, or missing Handling Methods

Solution to ORA-00257 archive logs being too large to store

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.