[begin_label:] REPEAT statement(s) UNTIL search_condition END REPEAT [end_label]
Les commandese à l'intérieur d'une commande
REPEAT
sont répétées jusqu'à ce que la
condition search_condition
soit vraie.
begin_label
et end_label
doivent être identiques, s'ils sont fournis.
Par exemple :
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)
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.