Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ITERATE - Switch to the next loop pass

The ITERATE statement switches to the next loop pass.
It may may only be specified in the control statements FOR, LOOP, REPEAT, and WHILE of a routine, i.e. in the context of a CREATE PROCEDURE or CREATE FUNCTION statement. Routines and their use in SESAM/SQL are described in detail in chapter "Routines".



ITERATE label



label

Label of the FOR, LOOP, REPEAT, or WHILE statement which contains the ITERATE statement. The current loop pass is terminated. The next loop pass is switched to.

Specifying label also enables outer loop passes to be terminated. Inner loop passes are then terminated immediately.

Example

When the value of variable i is divisible by 3, ITERATE causes the next loop pass to be switched to immediately.

DECLARE i INTEGER DEFAULT 1;
   ...
   label:
   REPEAT
       SET i = i + 1;
       IF MOD(i,3)=0 THEN ITERATE label;
       END IF;
       ...
       UNTIL i >100
   END REPEAT label;

See also

CREATE PROCEDURE, CREATE FUNCTION, FOR, LOOP, REPEAT, WHILE