REPEAT LOOP
Execute a block until a condition is met. This loop construct runs at least once and continues repeating as long as the UNTIL condition remains false.
Syntax
[begin_label:] REPEAT
statement_list
UNTIL search_condition
END REPEAT [end_label]DELIMITER //
CREATE PROCEDURE dorepeat(p1 INT)
BEGIN
SET @x = 0;
REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
END
//
CALL dorepeat(1000)//
SELECT @x//
+------+
| @x |
+------+
| 1001 |
+------+Last updated
Was this helpful?

