loop

-- ------------------------loop---------------------------
delimiter $
DROP PROCEDURE IF EXISTS my_count $
CREATE PROCEDURE my_count()
BEGIN

DECLARE count INT DEFAULT 0;
my_loop:
LOOP

  SET count=count+1;
    IF(count=10) THEN
      LEAVE my_loop;
    END IF;

  SELECT CONCAT(count," is select value ");

END LOOP ;

SELECT "i can count TO 10";

END $
delimiter;


CALL my_count();

DROP PROCEDURE my_count;

posted @ 2017-02-20 13:26  wlhebut  阅读(136)  评论(0编辑  收藏  举报