totn Oracle Error Messages

Oracle / PLSQL: ORA-02260 Error Message

Learn the cause and how to resolve the ORA-02260 error message in Oracle.

Description

When you encounter an ORA-02260 error, the following error message will appear:

  • ORA-02260: table can have only one primary key

Cause

You tried to create a primary key for a table that already has a primary key.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

You can drop the existing primary key for the table and create a new primary key.

For example, to drop the primary key named supplier_pk from the supplier table, you could execute the following command:

ALTER TABLE supplier
 DROP CONSTRAINT supplier_pk;

Then re-create your primary key.