我试图摆脱一个无聊的任务,即点击我的GUI的创建按钮来创建新行,所以我决定定义一个函数来执行它,因为我想要它多次至... 这是代码,但它在NAVICAT中返回错误:
CREATE FUNCTION AddRow (number INT)
BEGIN
SET @x = 0;
REPEAT
INSERT INTO 'result' () VALUES ()
SET @x += 1;
UNTIL x > @number END REPEAT;
END
call AddRow (10)
错误:
[SQL]CREATE FUNCTION AddRow (number INT)
BEGIN
SET @x = 0;
REPEAT
INSERT INTO 'result' () VALUES ()
SET @x += 1;
UNTIL x > @number END REPEAT;
END
call AddRow (10)
[Err] 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 'BEGIN
SET @x = 0;
REPEAT
INSERT INTO 'result' () VALUES ()
SET @x += ' at line 2