DELIMITER $$ USE `income_new`$$ DROP PROCEDURE IF EXISTS `a`$$ CREATE DEFINER=`income_new`@`%` PROCEDURE `a`()
BEGIN
DECLARE i LONG;
DECLARE ii LONG;
SET i=1;
SET ii=11; -- 如果 ii是LONG类型,并是两位数,循环体就只执行一遍,如果换成INT类型就正常执行
WHILE i<=ii DO
IF i=2 THEN
SELECT '22ok';
END IF;
SET i=i+1;
END WHILE;
END$$ DELIMITER ;