Informix Error -4119
-4119 Time-dependent functions must be used with the function
CONSTANT() in constant expressions.One of the constant expressions in this CONSTANT statement refers to function such as CURRENT, whose value depends on the current time. Such functions have to be written as arguments to the CONSTANT() function, which returns their value as of the time of compilation. (You cannot use the time of execution in a constant value.)
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4119 fires when a CONSTANT statement refers to a time-dependent function such as CURRENT
directly — per the official guidance, such functions must be wrapped in the CONSTANT()
function, which captures their value as of compile time (execution-time values can't be used
in a constant).
- A time-dependent function (e.g.
CURRENT) used directly in a constant expression, per the official guidance — the direct, only cause.
Solutions / Resolution
- Wrap the time-dependent function in
CONSTANT(), per the official guidance, to capture its value as of compilation time.
Examples
CURRENT used directly
CONSTANT build_time = CURRENT
-- -4119: CURRENT must be wrapped in CONSTANT()
Corrected
CONSTANT build_time = CONSTANT(CURRENT)
Diagnostic Checks
- Check every constant expression for a direct reference to a time-dependent function,
and wrap it in
CONSTANT().
Related Errors / Related Topics
- -4117 — "A constant expression is expected here." A related constant-expression error, about general non-evaluable expressions rather than this specific time-dependent-function case.
A time-dependent function is used directly in a constant expression — wrap it in CONSTANT().