无论内部代码如何,mysql事务都会失败

时间:2016-12-06 00:07:37

标签: mysql transactions syntax-error

我正在尝试在mySQL中编写一个事务,但无论我在标记之间放置什么都有错误。

start transaction;
set @email = "FOO";
PRINT @email;
commit; 

此块总是会产生错误:

SQL 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 'set @email_name = "FOO";
PRINT @email_name;
commit' at line 2
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'set @email_name = "FOO";
PRINT @email_name;
commit' at line 2

无论在事务中放置什么代码,都会发生此行为,如果有相关内容,则会出现此问题。

1 个答案:

答案 0 :(得分:0)

没有PRINT,请改用SELECT。