gpt4 book ai didi

无论里面的代码如何,mysql事务都会失败

转载 作者:行者123 更新时间:2023-11-29 19:45:51 26 4
gpt4 key购买 nike

我正在尝试在 mySQL 中编写事务,但无论我在标签之间放置什么,都会出现错误。

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

该 block 总是会产生错误:

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

无论事务中放置什么代码,这种行为都会发生,如果有注释,这种行为甚至会持续存在。

最佳答案

没有 PRINT,请使用 SELECT 代替。

关于无论里面的代码如何,mysql事务都会失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40985637/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com