I'm trying to get rid of a boring task of clicking on the create button of my GUI for creating new rows so I've decided to define a function to do that as many times as i want it to... here's the code, but it returns an error in 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)
Error:
[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