Informix Error -4106
-4106 An expression of type DATETIME is expected.
In an EVENT statement, a function definition or declaration, an EXTERNAL REPORT statement, a HANDLER statement, a function invocation, or just an expression, the compiler found something other than a DATETIME expression.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4106 fires when a context requiring a DATETIME expression instead finds something else —
per the official guidance, this can occur in an EVENT statement, a function definition or
declaration, an EXTERNAL REPORT statement, a HANDLER statement, a function invocation, or
a plain expression.
- A non-
DATETIMEexpression used whereDATETIMEis required, per the official guidance — the direct, only cause.
Solutions / Resolution
- Supply a genuine
DATETIMEexpression, converting the value first if needed.
Examples
A non-DATETIME expression where one is required
EVENT MyEvent(ts INTEGER)
-- -4106: if ts is used somewhere requiring DATETIME
Corrected
EVENT MyEvent(ts DATETIME YEAR TO SECOND)
Diagnostic Checks
- Check the expression's actual type against the context requiring
DATETIME, and convert it if necessary.
Related Errors / Related Topics
- -4107 — "An expression of type INTEGER or SMALLINT is expected." The same
type-requirement pattern applied to integer types instead of
DATETIME. - -4108 — "An expression of type DATE is expected." The same type-requirement pattern
applied to
DATEinstead ofDATETIME. - -4109 — "An expression of type DATE or DATETIME is expected." The same type-requirement
pattern, accepting either
DATEorDATETIME.
A DATETIME expression is required but something else was found — supply or convert to a
genuine DATETIME value.