Informix Error -685
-685 Function <function-name> returns too few values. </function-name>
The number of returned values from a function is less than the number of values that the caller expects.
Example of error:
CREATE ROUTINE testroutine (arg INT) RETURNING INT, INT; RETURN 1,2; END ROUTINE
UPDATE tab SET (c1, c2, c3) = (testroutine(1)); -- error
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-685 is the mirror image of -684: it fires when a routine is called in a context expecting
more return values than its RETURNING clause actually declares — per the official guidance's
example, a routine returning two integers used to populate three columns in an UPDATE.
- A routine called in a context expecting more values than it declares, per the official
guidance's example — an
UPDATE ... SET (col1, col2, col3) = routine(...)where the routine only returns two values. - A
RETURNINGclause narrowed during editing (removing a return value) without checking every call site still matches the new, smaller count.
Solutions / Resolution
- Check the routine's
RETURNINGclause and compare its value count against the calling context's expectation. - Reduce the calling context's expected count to match, if the routine genuinely returns
fewer values than the call site was written to expect:
UPDATE orders SET (total, item_count) = get_order_totals(order_id) WHERE order_id = 42; - Or widen the routine's
RETURNINGclause and add the missing value, if the call site's expectation was actually correct and the routine itself needs to return one more value.
Examples
The disallowed mismatch
CREATE FUNCTION get_order_totals(p_order_id INT)
RETURNING INT, INT; -- total, item_count
...
END FUNCTION;
UPDATE orders SET (total, item_count, last_updated) = get_order_totals(order_id)
WHERE order_id = 42;
-- -685: get_order_totals returns 2 values, this context expects 3
Corrected — matching counts
UPDATE orders SET (total, item_count) = get_order_totals(order_id)
WHERE order_id = 42;
Diagnostic Checks
- Count the values in the routine's
RETURNINGclause and compare against how many the calling context expects (anUPDATE ... SET (...)column list, a multi-variableLET, etc.).
Related Errors / Related Topics
- -655 — "RETURN value count does not match procedure declaration." A related return-count error, at the routine's own declaration rather than a caller.
- -684 — "Function function-name returns too many values." The mirror-image situation: the routine returns more values than the caller expects.
- -686 — "Function function-name has returned more than one row." A related error, about multiple rows rather than too few values in one row.
The mirror image of -684 — compare the routine's declared return count against what the specific call site expects, in the opposite direction.