Informix Error -661: Number of variables does not match number of values returned.
Cause and resolution
Number of variables does not match number of values returned.
The number of variables on the left side of a LET statement does not match the number of values on the right side.
Example of error:
LET a,b = 10,20,39; LET i,j = proc1()+proc2(); LET a,b = (SELECT c1 FROM tab)
Correction: Match the number of expressions on both sides of the LET statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-661 fires when a LET statement's left side (the variable list) has a different count than the
right side (the value list) — per the official guidance, the two counts must match exactly.
- A
LETstatement listing more variables than values, per the official guidance's exampleLET a,b = 10,20,39;reversed (too few values for the variable count is the mirror case). - A
LETstatement with multiple variables set from a single combined expression — per the official guidance's exampleLET i,j = proc1()+proc2();, where the right side evaluates to one value, not two, despite two functions being referenced. - A
LETstatement with multiple variables set from a subquery returning a single column — per the official guidance's exampleLET a,b = (SELECT c1 FROM tab), where the subquery returns one column's value, not two.
Solutions / Resolution
- Match the number of expressions on both sides of the
LETstatement, per the official guidance. - For two functions combined with an operator, call them separately if two distinct values are
needed, rather than combining them into one expression:
LET i = proc1(); LET j = proc2(); - For a subquery, select as many columns as there are variables, if multiple values are
genuinely needed:
LET a, b = (SELECT c1, c2 FROM tab WHERE ...);
Examples
Mismatched literal counts
LET a, b = 10, 20, 39;
-- -661: 2 variables, 3 values
A combined single-value expression assigned to two variables
LET i, j = proc1() + proc2();
-- -661: the expression evaluates to one value, not two
Corrected — separate calls
LET i = proc1();
LET j = proc2();
Diagnostic Checks
- Count the variables on the left of
LETand the values (or columns) the right side actually produces, confirming they match exactly.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -661 in this set yet.
Count both sides of the LET statement carefully — a combined expression or a single-column
subquery produces one value, not one per variable named.