SQLCODE -407
SQL0407 NULL in a column that does not allow it
- IBM message text
- Null values not allowed in column or variable &5.
- SQLCODE
- -407
- SQLSTATE
- 23502
Most common cause
INSERT, UPDATE or MERGE puts NULL in a NOT NULL column. Often the column was left out of the INSERT and has no default.
Other causes
- An INSERT ... SELECT from an outer join that produces NULLs.
- An indicator variable set to -1 by mistake.
- An ALTER TABLE making NOT NULL a column that already holds NULLs.
How to fix it
Give the column a value, add a DEFAULT to the table, or use COALESCE in the source SELECT.
Related errors
Text and codes from IBM documentation for 7.6. Checked on .