Informix Error -4143: Functions called in the WHENEVER statement cannot return values.
Cause and resolution
Functions called in the WHENEVER statement cannot return values.
The WHENEVER statement in the program has the form WHENEVER condition CALL function, and the function that is being called is declared with a RETURNING clause. The function call in this context cannot return any values.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4143 fires when a WHENEVER condition CALL function statement names a function declared with
a RETURNING clause — per the official guidance, the function call in this context can't
return any values.
- The function named in
WHENEVER ... CALLis declared with aRETURNINGclause, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use a function with no
RETURNINGclause in theWHENEVER ... CALLstatement.
Examples
A WHENEVER CALL to a function that returns a value
FUNCTION handleError() RETURNING INTEGER
...
END FUNCTION
WHENEVER ERROR CALL handleError
-- -4143: handleError() returns a value, which is not allowed here
Corrected
FUNCTION handleError()
...
END FUNCTION
WHENEVER ERROR CALL handleError
Diagnostic Checks
- Check the function named in every
WHENEVER ... CALLstatement, and confirm it has noRETURNINGclause.
Related Errors / Related Topics
- -4142 — "Functions called in the WHENEVER statement cannot require parameters." A
closely related
WHENEVER ... CALLrestriction, about the function's parameters rather than its return value.
A WHENEVER ... CALL function is declared with a RETURNING clause, which isn't allowed —
use a function that returns nothing.