Informix Error -4066
-4066 RETURN statement not allowed in the body of intrinsic functions.
This statement is part of the definition of an intrinsic member function (the class constructor, !copy, and so on). These functions do not have explicit result values; or more precisely, code that the compiler automatically generates produces their returned values. Delete the RETURN statement.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4066 fires when a RETURN statement appears inside an intrinsic member function's body (the
constructor, !copy(), etc.) — per the official guidance, intrinsic functions don't have
explicit result values; the compiler automatically generates the code that produces their
returned values.
- A
RETURNstatement inside an intrinsic member function, per the official guidance — the direct, only cause.
Solutions / Resolution
- Delete the
RETURNstatement, per the official guidance.
Examples
A RETURN statement inside a constructor
CLASS Order
FUNCTION Order()
LET SELF.status = "New"
RETURN
-- -4066: RETURN is not allowed in an intrinsic function body
END FUNCTION
END CLASS
Corrected
CLASS Order
FUNCTION Order()
LET SELF.status = "New"
END FUNCTION
END CLASS
Diagnostic Checks
- Check every intrinsic member function's body for a
RETURNstatement, and delete it.
Related Errors / Related Topics
- -4014 — "You cannot specify the RETURNING type for intrinsic member functions." A
related intrinsic member-function rule, about the declaration's
RETURNINGclause rather than aRETURNstatement in the body.
A RETURN statement appears inside an intrinsic member function's body — delete it; the
compiler generates the return value automatically.