PL/I · DB2 SQLCODE

SQLCODE -530: Invalid Foreign Key Value

What does SQLCODE -530: Invalid Foreign Key Value mean in PL/I?

An INSERT or UPDATE from the PL/I program placed a value in a foreign key column that doesn't match any parent key value in the referenced table — the child row's key value was built from data that never got a matching parent row inserted first.

SQLCODE -530: Invalid Foreign Key ValueDB2 for z/OS · PL/I (embedded SQL)

Condition

An INSERT or UPDATE from the PL/I program placed a value in a foreign key column that doesn't match any parent key value in the referenced table — the child row's key value was built from data that never got a matching parent row inserted first.

Fix

Insert or verify the parent row exists before inserting the dependent row, and check the upstream data preparation logic for a bad or stale key value being passed into the host variable.

Related db2 sqlcode