my82kole
my82kole
2018-11-11 09:56

sql语句问题为什么在数据库中文可以执行但在mybatis中就不行求大佬指点 万分感谢

  • mybatis
  • mysql

图片说明

这可以执行图片说明
但在mybatis中PREPARE texts FROM @a就出现异常错误了
异常是
SQL: SET @a=CONCAT('SELECT a.accout_,a.name,a.birthday_,b.name_j FROM users a,role b,users_role c WHERE a.id=c.user_id AND b.id_j=c.role LIMIT ',(1-1)*3,",",3,'') PREPARE texts FROM @a EXECUTE texts

Cause: 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 'PREPARE texts FROM @a

EXECUTE texts' at line 2
; bad SQL grammar []; nested exception is 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 'PREPARE texts FROM @a
EXECUTE texts' at line 2

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答