ITERATE

The ITERATE statement is used in SQL Script to continue the execution of the specified label.

Syntax

ITERATE <label>

Remark

The ITERATE statement is equivalent to continue in Java. It jumps to the end of the loop block and causes the loop to evaluate its condition (if available) and loop back to the top.

Example

PROCEDURE
BEGIN
  DECLARE c CHAR(1);
  DECLARE ix INTEGER DEFAULT 1;
  SET result = ' ';
  label a:
  WHILE ix <= LENGTH(s) DO
  SET c = CAST(SUBSTRING(s, ix, 1) AS CHAR(1));
  SET ix = ix + 1;
  IF c = ' ' THEN
    ITERATE label_a;
  END IF;
  SET result = CAST(CONCAT(result, c) AS VARCHAR);
  END WHILE;
END