Informix Error -4351
-4351 The program cannot continue a WHILE loop at this time because
it is not within a WHILE loop.A CONTINUE WHILE statement is not between a WHILE statement and its matching END WHILE statement. Perhaps the WHILE statement has been accidentally deleted, or perhaps you changed to another type of loop such as FOREACH or FOR.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4351 fires when CONTINUE WHILE doesn't fall between a WHILE statement and its matching
END WHILE — per the official guidance, the WHILE statement may have been accidentally
deleted, or the loop type may have been changed to FOREACH/FOR without updating the
CONTINUE.
CONTINUE WHILEused where the enclosing loop isn't aWHILEloop, per the official guidance — the direct, only cause.
Solutions / Resolution
- Check whether the
WHILEstatement was accidentally deleted, per the official guidance. - If the loop type was changed to
FOREACH/FOR, update theCONTINUEkeyword to match, per the official guidance.
Examples
CONTINUE WHILE inside a FOR loop
FOR i = 1 TO 10
CONTINUE WHILE
-- -4351: this is a FOR loop, not a WHILE loop
END FOR
Corrected
FOR i = 1 TO 10
CONTINUE FOR
END FOR
Diagnostic Checks
- Check the enclosing loop's actual type, and match the
CONTINUEkeyword to it.
Related Errors / Related Topics
- -4316 — "The program cannot exit a WHILE statement at this point because it is not
within a WHILE statement." The
EXIT WHILEcounterpart of this sameCONTINUE WHILEcondition. - -4350 — "The program cannot continue a FOR loop at this time because it is not within
a FOR loop." The same pattern applied to
FORinstead ofWHILE. - -4352 — "The program cannot continue a FOREACH loop at this time because it is not
within a FOREACH loop." The same pattern applied to
FOREACHinstead ofWHILE.
CONTINUE WHILE is used outside a WHILE loop — match the CONTINUE keyword to the loop's
actual type.