13.6.5.8 WHILE Syntax

The statement list within a WHILE statement is repeated as long as the search_condition expression is true. statement_list consists of one or more SQL statements, each terminated by a semicolon(;) statement delimiter.

A WHILE statement can be labeled. For the rules regarding label use, see Section 13.6.2, "Statement Label Syntax".

Example:

CREATE PROCEDURE dowhile()
BEGIN
    DECLARE v1 int default 5;

    while v1 > 0 do
    # ...
    set v1  = v1 - 1;
    end while;
END$$

results matching ""

    No results matching ""