Informix Error -26032: Invalid label label-name used with EXIT WHEN clause.
Cause and resolution
Invalid label label-name used with EXIT WHEN clause.
The label is not defined or is not a valid label for the LOOP statement. The EXIT WHEN label must be defined within a scope that the LOOP statement can reach. Check the label-names for correct spelling.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26032 fires when an EXIT WHEN clause names a label that isn't defined, or isn't a valid
target for the enclosing LOOP statement — per the official guidance.
- The named label isn't defined, per the official guidance — the first named case.
- The named label isn't within a scope the
LOOPstatement can reach, per the official guidance — the second named case.
Solutions / Resolution
- Check the label name's spelling, per the official guidance.
- Define the label within a scope the
LOOPstatement can reach, per the official guidance's implication.
Examples
An EXIT WHEN naming an out-of-scope label
<<loop_a>> LOOP
EXIT loop_a WHEN x > 10;
END LOOP loop_a;
<<loop_b>> LOOP
EXIT loop_a WHEN y > 5;
-- -26032: loop_a is a sibling label, not reachable from loop_b
END LOOP loop_b;
Corrected
<<loop_b>> LOOP
EXIT loop_b WHEN y > 5;
END LOOP loop_b;
Diagnostic Checks
- Check the
EXIT WHENclause's label spelling, and confirm the label is reachable from theLOOPstatement using it.
Related Errors / Related Topics
- -26030 — "Invalid usage of EXIT or CONTINUE statement, which should be within a
statement loop." A related
EXIT-usage error, on being outside a loop entirely rather than an invalid label. - -26031 — "END LOOP label label-name doesn't not match with the LOOP label
label-name." A related label-validity error, on
LOOP/END LOOPpairing rather thanEXIT WHEN.
An EXIT WHEN clause named an undefined or out-of-scope label — check its spelling and
scope.