PL/I · DB2 SQLCODE

SQLCODE -803: Duplicate Key Value in Insert or Update

What does SQLCODE -803: Duplicate Key Value in Insert or Update mean in PL/I?

An INSERT or UPDATE issued from the PL/I program would create a row whose value duplicates an existing row's value in a column enforced unique by a primary key, unique constraint, or unique index.

SQLCODE -803: Duplicate Key Value in Insert or UpdateDB2 for z/OS · PL/I (embedded SQL)

Condition

An INSERT or UPDATE issued from the PL/I program would create a row whose value duplicates an existing row's value in a column enforced unique by a primary key, unique constraint, or unique index.

Fix

Check for the duplicate before inserting, or catch -803 in the SQLCA and treat it as an expected 'already exists' case, and verify the host variables driving the key columns are actually distinct across the rows being loaded.

Related db2 sqlcode