Informix Error -4064
-4064 Type of returned value does not match the declared return type of
function "name".The function "name" was not explicitly declared but has already been called with one prototype, and the current call provides a different prototype. Make sure that you have called the function you intended. Then review its earlier call, or create an explicit declaration for it.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4064 fires when a function that was never explicitly declared has already been called with one implied prototype, and the current call implies a different one — per the official guidance, the function's type was inferred informally from an earlier call, and this call disagrees with it.
- A function called with a different implied prototype than an earlier call established, per the official guidance — the direct, only cause.
Solutions / Resolution
- Make sure the function called was the one intended, per the official guidance.
- Review the earlier call, or create an explicit declaration for the function, per the official guidance.
Examples
Two calls implying different return types
LET x = compute(1)
-- earlier call implies compute() returns an INTEGER
LET y = compute(2)
-- -4064: this call's context implies a different return type
Corrected, with an explicit declaration
FUNCTION compute(n INTEGER) RETURNING INTEGER
...
END FUNCTION
Diagnostic Checks
- Check every call site of the informally-typed function, and add an explicit declaration to remove the ambiguity.
Related Errors / Related Topics
- -4053 — "Function "name" has already been declared with a different prototype." A related consistency error, about explicit formal declarations disagreeing rather than informally-inferred prototypes.
- -4054 — "Function "name" has already been declared with a different return type." A related consistency error, about explicit formal declarations' return types disagreeing.
An informally-typed function's calls imply disagreeing prototypes — add an explicit declaration to resolve the ambiguity.