我有一个小事务的代码。但是MYSQL不断抛出语法错误。我在.sql文件中编写了下面的代码,并使用命令'source filename'在mysql中运行它,但它抛出以下错误:
ERROR 1064 (42000): 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 'INSERT INTO tab VALUES (1,"A1", 10000,100);
INSERT INTO tab VALUES (2,"A2", 1000' at line 2
你能在我的代码中找到错误,如下所示吗?
DELIMITER **
START TRANSACTION
INSERT INTO tab VALUES (1,"A1", 10000,100);
INSERT INTO tab VALUES (2,"A2", 10000,100);
INSERT INTO tab VALUES (3,"A3", 10000,100);
INSERT INTO tab VALUES (4,"A4", 10000,100);
INSERT INTO tab VALUES (5,"A5", 10000,100);
INSERT INTO tab VALUES (6,"A6", 10000,100);
INSERT INTO tab VALUES (7,"A7", 10000,100);
INSERT INTO tab VALUES (8,"A8", 10000,100);
INSERT INTO tab VALUES (9,"A9", 10000,100);
INSERT INTO tab VALUES (10,"A10", 10000,100);
END TRANSACTION;
DELIMITER ;
我认为INSERT的语法可能有误,但是当我只运行一个插入查询时,它可以工作。 我在这里找不到任何错误。我使用mysql 5.5.41
答案 0 :(得分:0)
你错过了一个分号:
START TRANSACTION;