RDBMS Type: MySQL
END LOOP [end_label]
END REPEAT [end_label]
[begin_label:] WHILE search_condition DO
END WHILE [end_label]
Labels are permitted for BEGIN ... END blocks and for the LOOP, REPEAT,
and WHILE statements. Label use for those statements follows these
o begin_label must be followed by a colon.
o begin_label can be given without end_label. If end_label is present,
it must be the same as begin_label.
o end_label cannot be given without begin_label.
o Labels at the same nesting level must be distinct.
o Labels can be up to 16 characters long.
To refer to a label within the labeled construct, use an ITERATE or
LEAVE statement. The following example uses those statements to
continue iterating or terminate the loop:
CREATE PROCEDURE doiterate(p1 INT)
SET p1 = p1 + 1;
IF p1 < 10 THEN ITERATE label1; END IF;
END LOOP label1;
The scope of a block label does not include the code for handlers
declared within the block. For details, see [HELP DECLARE HANDLER].