RPG (IBM i / AS/400) · DB2 SQLCODE
What does SQLCODE -530 - Invalid Foreign Key Value mean in RPG (IBM i / AS/400)?
An INSERT or UPDATE supplied a foreign key value that doesn't exist as a primary or unique key value in the parent table, violating a referential constraint on the table.
An INSERT or UPDATE supplied a foreign key value that doesn't exist as a primary or unique key value in the parent table, violating a referential constraint on the table.
Verify the parent row exists before writing the child row, or catch this SQLCODE and prompt the user with a clear message instead of letting the exception propagate; check whether the key value is coming from stale or unvalidated input.