1:存储过程
DELIMITER $$
DROP PROCEDURE IF EXISTS test$$
CREATE PROCEDURE test()
BEGIN
DECLARE xx INT DEFAULT 10000;
while (xx>0) do
set xx = xx-1;
select xx;
end while;
END$$
BEGIN
DECLARE xx INT DEFAULT 10000;
while (xx>0) do
set xx = xx-1;
select xx;
end while;
END$$
DELIMITER ;
执行:mysql>delimiter;//输出执行信息
mysql>call test();