(mysql.info.gz) REPEAT Statement
Info Catalog
(mysql.info.gz) ITERATE Statement
(mysql.info.gz) Flow Control Constructs
(mysql.info.gz) WHILE Statement
19.1.9.6 `REPEAT' Statement
...........................
[BEGIN_LABEL:] REPEAT
STATEMENT_LIST
UNTIL SEARCH_CONDITION
END REPEAT [END_LABEL]
The statement or statements within a `REPEAT' statement are repeated
until the SEARCH_CONDITION is true.
BEGIN_LABEL and END_LABEL must be the same, if both are specified.
For example:
mysql> delimiter //
mysql> CREATE PROCEDURE dorepeat(p1 INT)
-> BEGIN
-> SET @x = 0;
-> REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
-> END
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> CALL dorepeat(1000)//
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @x//
+------+
| @x |
+------+
| 1001 |
+------+
1 row in set (0.00 sec)
Info Catalog
(mysql.info.gz) ITERATE Statement
(mysql.info.gz) Flow Control Constructs
(mysql.info.gz) WHILE Statement
automatically generated byinfo2html