Informix Error -656
-656 Routine is not declared to return values.
When the routine was declared, it did not contain a RETURNING clause to indicate that the routine would not return any value, but then a RETURN statement was found in the body of the routine.
An example of the error follows:
CREATE ROUTINE testproc() DEFINE a INT; LET a = 10; RETURN a + 1; -- error END ROUTINE
Correction: Add a RETURNING clause before the DEFINE statement, or remove the RETURN statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-656 fires when a routine's body contains a RETURN statement but its declaration has no
RETURNING clause — per the official guidance, a routine without RETURNING is declared to
return nothing, so any RETURN (with or without values) in its body is unexpected.
- A
RETURNstatement left in a routine whoseRETURNINGclause was removed during editing, without also removing the now-invalidRETURN. - A routine intended to return a value, but the
RETURNINGclause was forgotten when the routine was first written. - A bare
RETURN;(no values) used to exit a void routine early — per the official guidance, this specific case is also invalid withoutRETURNING; useEXITor restructure the control flow to exit early instead.
Solutions / Resolution
- Add a
RETURNINGclause before the routine body, per the official guidance, if the routine genuinely needs to return one or more values. - Or remove the
RETURNstatement from the routine body, per the official guidance, if the routine genuinely returns nothing.
Examples
The disallowed attempt
CREATE PROCEDURE log_order_event(p_order_id INT)
DEFINE v_status CHAR(10);
...
RETURN;
-- -656: no RETURNING clause was declared
END PROCEDURE;
Corrected — remove RETURN
CREATE PROCEDURE log_order_event(p_order_id INT)
DEFINE v_status CHAR(10);
...
END PROCEDURE;
Or corrected — add RETURNING if a value was actually intended
CREATE PROCEDURE log_order_event(p_order_id INT)
RETURNING INT;
DEFINE v_status CHAR(10);
...
RETURN 1;
END PROCEDURE;
Diagnostic Checks
- Check whether the routine's declaration includes a
RETURNINGclause, and whether the body'sRETURNstatement(s) are actually needed given the routine's intended purpose.
Related Errors / Related Topics
- -655 — "RETURN value count does not match procedure declaration." A related return-value
mismatch error, about a count mismatch once
RETURNINGdoes exist, rather thanRETURNINGbeing absent entirely.
RETURN requires a matching RETURNING clause on the routine declaration — add one, or remove
the RETURN if the routine genuinely returns nothing.