Informix Error -11021: Insert value list does not match column list.
Cause and resolution
Insert value list does not match column list.
This Informix CLI error code is the same as SQLSTATE value 21S01. The following functions can return this error code: SQLExecDirect() and SQLPrepare().
The SQL statement contained an INSERT statement, but the number of values to insert was not the same as the number of columns into which to insert values. Change the INSERT statement so that the number of values to insert is the same as the number of columns into which to insert values.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-11021 fires when an INSERT statement's value list doesn't match its column list in
count — per the official guidance, this is the same as SQLSTATE value 21S01.
- An
INSERTstatement whose value count doesn't equal its target column count, per the official guidance — the direct, only cause.
Solutions / Resolution
- Change the
INSERTstatement so the number of values matches the number of target columns, per the official guidance.
Examples
An INSERT with mismatched counts
INSERT INTO orders (order_id, customer_id, total) VALUES (1001, 42);
-- -11021: 2 values for 3 columns
Corrected
INSERT INTO orders (order_id, customer_id, total) VALUES (1001, 42, 99.00);
Diagnostic Checks
- Count the columns and values in the
INSERTstatement, and confirm they match.
Related Errors / Related Topics
- -11022 — "Degree of derived table does not match column list." The same class of
count-mismatch error, for
CREATE VIEWrather thanINSERT.
An INSERT's value list doesn't match its column list in count — align the two.