DROP PROCEDURE IF EXISTS while1;
CREATE PROCEDURE while1()
BEGIN
 DECLARE v_max INT DEFAULT 15; 
 DECLARE v_counter INT DEFAULT 0;
 
  WHILE v_counter < v_max do
    SELECT v_counter;  
    SET v_counter=v_counter+1;
  END WHILE; 
END;

Leave a reply