Icon ITERATE

Jumps to the top of a loop.

Syntax
ITERATE [<Label>]

Usage
Use this statement to jump to the top of the current loop or a specified loop using the name of a labeled loop. This statement is only valid within a LOOP, REPEAT, or WHILE loop.

Examples
-- This procedure deletes all rows
-- in the Customers table with a State
-- column of 'FL'

CREATE PROCEDURE DeleteFLCustomers()
BEGIN
   DECLARE CustCursor CURSOR WITH RETURN FOR Stmt;
   DECLARE State CHAR(2) DEFAULT '';

   PREPARE Stmt FROM 'SELECT * FROM Customer';

   OPEN CustCursor;

   FETCH FIRST FROM CustCursor ('State') INTO State;

   WHILE NOT EOF(CustCursor) DO
      IF (State='FL') THEN
         DELETE FROM CustCursor;
         FETCH FROM CustCursor ('State') INTO State;
         ITERATE;
      END IF;
      FETCH NEXT FROM CustCursor ('State') INTO State;
   END WHILE;
END

SQL 2003 Standard Deviations
This statement deviates from the SQL 2003 standard in the following ways:

DeviationDetails
Optional LabelThe label is optional in ElevateDB, and if not provided, defaults to the current loop being executed.
Image