Informix Error -4328: The variable variable-name has too complex a type to be used as the destination of a return from a function.
Cause and resolution
The variable variable-name has too complex a type to be used as the destination of a return from a function.
The named variable is a record or an array. Only simple variables can be returned by a function, although the function can return a list of simple variables. In the case of a record, you can use the asterisk or THRU notation as shorthand to specify a list of components.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4328 fires when a function's return value is captured into a record or array as a whole — per
the official guidance, only simple variables can be returned by a function (though a function
can return a list of them); for a record, asterisk or THRU notation can serve as shorthand
for a list of its components.
- A function's return value captured into a record or array as a whole, per the official guidance — the direct, only cause.
Solutions / Resolution
- Capture the return value into simple variables, per the official guidance, using
asterisk or
THRUnotation as shorthand for a record's component list if needed.
Examples
Returning into a whole array
DEFINE results ARRAY[5] OF INTEGER
CALL computeAll() RETURNING results
-- -4328: results is an ARRAY, not a list of simple variables
Corrected
CALL computeAll() RETURNING results[1], results[2], results[3], results[4], results[5]
Diagnostic Checks
- Check every
RETURNINGclause's target, and confirm it's a simple variable or a list of them (using asterisk/THRUshorthand for a record's components).
Related Errors / Related Topics
- -4323 — "The variable variable-name is too complex a type to be used in an assignment
statement." A related complex-type restriction, about plain assignment rather than a
function's
RETURNINGtarget.
A function's return value is captured into a record or array as a whole — capture it into simple variables instead.