Informix Error -1333: Strings of length > 512 cannot be returned from function calls.
Cause and resolution
Strings of length > 512 cannot be returned from function calls.
The current RETURN statement contains an expression that evaluates to a character string longer than 512 characters. This situation is not supported. Review the logic of the function, and modify it so that it does not return such a long character value. You can assign a longer string to a global variable.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1333 fires when a RETURN statement's character-string expression exceeds 512 characters — per
the official guidance, this length is unsupported for function return values.
- A
RETURNexpression producing a string longer than 512 characters, per the official guidance — the direct, only cause.
Solutions / Resolution
- Refactor the function to avoid returning such a lengthy string, per the official guidance.
- Assign the longer string value to a global variable instead, per the official guidance's alternative.
Examples
A function returning an oversized string
FUNCTION build_report_line()
DEFINE v_line CHAR(1000);
-- ... build v_line ...
RETURN v_line;
-- -1333: v_line's returned value can exceed 512 characters
END FUNCTION
Corrected — use a global variable
GLOBALS
DEFINE g_report_line CHAR(1000);
END GLOBALS
FUNCTION build_report_line()
-- ... build g_report_line directly ...
END FUNCTION
Diagnostic Checks
- Check the actual length of the string produced by the
RETURNexpression, and confirm whether it can exceed 512 characters.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -1333 in this set yet.
A function tried to return a string longer than 512 characters — refactor to use a global variable instead.