Informix Error -4067
-4067 This RETURN statement must provide a value.
This RETURN statement does not specify a value to return, but the function was declared with a RETURNING clause that specified other than VOID. If you want to terminate a function early without producing a value, you could put a label on the END FUNCTION statement and use a GOTO, or redesign the function logic to avoid the need for an early exit.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4067 fires when a RETURN statement provides no value, but the enclosing function was
declared with a RETURNING clause specifying something other than VOID — per the official
guidance, a value is required in this case.
- A bare
RETURNstatement in a function declared to return a non-VOIDvalue, per the official guidance — the direct, only cause.
Solutions / Resolution
- Provide a value in the
RETURNstatement, matching the function's declared return type. - If an early exit without a value is genuinely needed, put a label on
END FUNCTIONand useGOTO, or redesign the function's logic to avoid the early exit, per the official guidance.
Examples
A valueless RETURN in a non-VOID function
FUNCTION compute() RETURNING INTEGER
IF condition THEN
RETURN
-- -4067: compute() must return an INTEGER
END IF
RETURN 0
END FUNCTION
Corrected
FUNCTION compute() RETURNING INTEGER
IF condition THEN
RETURN -1
END IF
RETURN 0
END FUNCTION
Diagnostic Checks
- Check every
RETURNstatement in a non-VOIDfunction, and confirm each one provides a value.
Related Errors / Related Topics
- -4063 — "Function "name" should not return any results." The mirror-image error, about
a
VOIDfunction being called as if it returned a value, rather than a non-VOIDfunction'sRETURNmissing one.
A RETURN statement in a non-VOID function is missing its value — provide one, or restructure
to avoid the early exit.