Informix Error -6027: Cannot insert a NULL value into a NOT NULL column.
Cause and resolution
Cannot insert a NULL value into a NOT NULL column.
This call to dbadd() or dbupdate() has attempted to insert a row that contains a null value for a column that is constrained to be not null. Possibly the program placed a null in the record buffer using dbsetnull(), or the current view omits a column that is constrained to be not null. The row is not inserted. Review the definition of the table and the program logic, and change it so that it to define values for all not null columns before an add or update.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-6027 fires when dbadd()/dbupdate() attempts to write a null into a column constrained to be
not null — per the archived catalogue, this can come from an explicit dbsetnull() call or a
view that omits a not-null column entirely.
- An explicit null set via
dbsetnull()on a not-null column, per the archived catalogue. - The current view omitting a column that's constrained to be not null, per the archived catalogue.
Solutions / Resolution
- Review the table definition and program logic, per the archived catalogue, and ensure values are supplied for every not-null column before an add or update.
Examples
N/A
No specific triggering statement is documented beyond the function-level condition described above.
Diagnostic Checks
- Check which not-null column is missing a value, and whether the view includes it.
Related Errors / Related Topics
- -6017 — "Cannot add a duplicate value; the index has been defined as UNIQUE."
- -6030 — "Cannot add a duplicate value; the index has been defined as UNIQUE."
A missing value for a NOT NULL column — ensure every such column has a value before the add/update.