← All errors

SQLCODE -803

SQL0803 Duplicate key value

IBM message text
Duplicate key value specified.
SQLCODE
-803
SQLSTATE
23505

Most common cause

INSERT or UPDATE that violates a primary key, a UNIQUE constraint or a unique index.

Other causes

  • A unique index built on a DDS logical file, invisible when looking at the table alone.
  • An IDENTITY column out of step after loading data by hand.

How to fix it

Use MERGE to insert or update, or check first. For an IDENTITY out of step: ALTER TABLE ... ALTER COLUMN ... RESTART WITH.

Related errors

Text and codes from IBM documentation for 7.6. Checked on .