[begin_label:] WHILE search_condition DO statement(s) END WHILE [end_label]
The statements within a WHILE
statement are
repeated as long as the search_condition
is
true.
begin_label
and
end_label
must be the same, if both are
specified.
For example:
CREATE PROCEDURE dowhile() BEGIN DECLARE v1 INT DEFAULT 5; WHILE v1 > 0 DO ... SET v1 = v1 - 1; END WHILE; END
This is a translation of the MySQL Reference Manual that can be found at dev.mysql.com. The original Reference Manual is in English, and this translation is not necessarily as up to date as the English version.