mysql要怎么循环
之前一直在弄MSSQL
mysql要怎么循环,一个循环弄了好久,网上都找不到什么资料。
SET @a=1;
WHILE @a<10
DO
SET @a=@a+1
END WHILE;
SELECT @a;
会报错
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @a<10
DO
SET @a=@a+1
END WHILE' at line 1
------解决方案--------------------delimiter $$
CREATE PROCEDURE ptest()
BEGIN
SELECT 'Hello Word!';
END$$
delimiter ;
------解决方案--------------------直接在MYSQL命令行工具中先测试一下。
MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html