CONTINUE
Use the CONTINUE statement to start the next iteration of the innermost FOR, LOOP, WHILE, or FOREACH loop.
Syntax
>>-CONTINUE--+---------+--;------------------------------------>< +-FOR-----+ +-FOREACH-+ +-LOOP----+ '-WHILE---'
Usage
When control of execution passes to a CONTINUE statement, the SPL routine skips the rest of the statements in the innermost loop of the specified type. Execution continues at the top of the loop with the next iteration.
CREATE FUNCTION loop_skip()
RETURNING INT;
DEFINE i INT;
...
FOR i IN (3 TO 15 STEP 2)
INSERT INTO testtable values(i, null, null);
IF i = 11
CONTINUE FOR;
END IF;
RETURN i WITH RESUME;
END FOR;
END FUNCTION;
Just as with the EXIT statement, (EXIT), in FOREACH statements and in FOR or WHILE statements that do not include the LOOP keyword, the FOR, WHILE, or FOREACH keyword must immediately follow the CONTINUE keyword to specify the type of loop. Errors are generated if the specified type of loop does not match the context in which the CONTINUE statement is issued.
In the LOOP, FOR LOOP, and WHILE LOOP statements, whether labeled or unlabeled, a keyword indicating the type of loop is optional after the CONTINUE keyword, but Informix® issues an error if you specify a keyword that does not correspond to the type of loop.