← All errors

SQLCODE -530

SQL0530 Foreign key violation

IBM message text
Operation not allowed by referential constraint &1 in &2.
SQLCODE
-530
SQLSTATE
23503

Most common cause

INSERT, UPDATE or MERGE with a foreign key value that does not exist in the parent table.

Other causes

  • Data loaded in the wrong order (children before parents).
  • An ON DELETE SET DEFAULT rule whose default value is not in the parent.

How to fix it

Insert the parent row first, or fix the foreign key value.

Related errors

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