Informix Error -4300: This statement contains too many levels of function call nesting.
Cause and resolution
This statement contains too many levels of function call nesting.
This statement has calls to functions that are nested within the parameter lists of other function calls, to a level exceeding four. The maximum level supported is four, as in the following expression: Afun(2-Bfun(3+Cfun(4*Dfun(5)))).
Rewrite the expression to store the result of the innermost function calls in a variable, and use the variable in the expression.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4300 fires when function calls are nested within other function calls' parameter lists beyond
four levels deep — per the official guidance, the maximum supported nesting is four, as in
Afun(2-Bfun(3+Cfun(4*Dfun(5)))).
- Function calls nested more than four levels deep within each other's parameter lists, per the official guidance — the direct, only cause.
Solutions / Resolution
- Rewrite the expression to store the innermost function calls' results in variables, per the official guidance, then use those variables in the outer expression.
Examples
Excessive function-call nesting
LET x = Afun(2-Bfun(3+Cfun(4*Dfun(5*Efun(6)))))
-- -4300: five levels of nested function calls exceeds the limit of four
Corrected
LET inner = Efun(6)
LET x = Afun(2-Bfun(3+Cfun(4*Dfun(5*inner))))
Diagnostic Checks
- Count the nesting depth of function calls within a single expression, and store intermediate results in variables if it exceeds four.
Related Errors / Related Topics
- -4301 — "The program has too many levels of WHILE, FOR, MENU, and/or CASE statements." A related nesting-depth limit, about control-structure nesting rather than function-call nesting.
An expression nests more than four levels of function calls — store intermediate results in variables instead.