DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) repeat-statement

Info Catalog (mysql.info) iterate-statement (mysql.info) flow-control-constructs (mysql.info) while-statement
 
 17.2.10.6 `REPEAT' Statement
 ............................
 
      [BEGIN_LABEL:] REPEAT
          STATEMENT_LIST
      UNTIL SEARCH_CONDITION
      END REPEAT [END_LABEL]
 
 The statement list within a `REPEAT' statement is repeated until the
 SEARCH_CONDITION is true. Thus, a `REPEAT' always enters the loop at
 least once. STATEMENT_LIST consists of one or more statements.
 
 A `REPEAT' 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:
 
      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) iterate-statement (mysql.info) flow-control-constructs (mysql.info) while-statement
automatically generated byinfo2html