mysql>
mysql>
mysql> delimiter //
mysql> create procedure test_while (IN in_count INT)
-> BEGIN
-> declare count INT default 0;
->
-> while count < 10 do
-> set count = count + 1;
-> end while;
->
-> select count;
-> END
-> //
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> delimiter ;
mysql>
mysql> call test_while(10);
+-------+
| count |
+-------+
| 10 |
+-------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> drop procedure test_while;
Query OK, 0 rows affected (0.00 sec)