ITERATE

Synopsis

ITERATE label

Description

The ITERATE statement allows processing of blocks in SQL routines to move processing back to the start of a context block. Contexts are defined by a label. If no label is found, the functions fails with an error message.

Examples

FUNCTION count()
RETURNS bigint
BEGIN
  DECLARE a int DEFAULT 0;
  DECLARE b int DEFAULT 0;
  top: REPEAT
    SET a = a + 1;
    IF a <= 3 THEN
        ITERATE top;
    END IF;
    SET b = b + 1;
  RETURN b;
END

Further examples of varying complexity that cover usage of the ITERATE statement in combination with other statements are available in the SQL routines examples documentation.

See also

success-mail-img

You've joined our email list. Our newsletter will be delivered to your inbox every other week, with news from Peaka and the no-code world, as well as updates on the latest trends and developments in the data integration space!

success-mail-img

Thank you for your interest. We'll contact you soon.