Informix Error -4139
-4139 The constant "name" cannot be used within its own definition.
A constant cannot be used until it is defined. Therefore, a constant cannot be used in its own definition.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4139 fires when a CONSTANT statement's own definition references the constant being
defined — per the official guidance, a constant can't be used before it's defined, and that
includes within its own definition.
- A constant's definition expression references the same constant being defined, per the official guidance — the direct, only cause.
Solutions / Resolution
- Remove the self-reference from the constant's definition, computing its value from other already-defined values instead.
Examples
A constant referencing itself
CONSTANT max_retries = max_retries + 1
-- -4139: max_retries is not yet defined at this point
Corrected
CONSTANT base_retries = 3
CONSTANT max_retries = base_retries + 1
Diagnostic Checks
- Check every constant's definition expression for a reference to the constant being defined, and remove it.
Related Errors / Related Topics
- -4117 — "A constant expression is expected here." A related constant-expression error, about non-evaluable expressions generally rather than this specific self-reference case.
A constant's own definition references itself — compute its value from other already-defined constants instead.