[begin_label:] WHILEsearch_conditionDOstatement_listEND WHILE [end_label]
The statement list within a
WHILE
statement is repeated as long as the
search_condition is true.
statement_list consists of one or
more statements.
A
WHILE
statement can be labeled. end_label
cannot be given unless begin_label
also is present. If both are present, they must be the same.
Example:
CREATE PROCEDURE dowhile()
BEGIN
DECLARE v1 INT DEFAULT 5;
WHILE v1 > 0 DO
...
SET v1 = v1 - 1;
END WHILE;
END

User Comments
If the above example doesn't work for you,
wrap the statements within the while loop with BEGIN/END.
WHILE [condition] DO
BEGIN
..code...
END;
END WHILE;
Had to do this on windows to get mysql to add function. Still testing...
-neil
Add your own comment.