my82kole 2018-11-11 09:56 采纳率: 0%
浏览 1911

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

图片说明

这可以执行图片说明
但在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条回答 默认 最新

  • 开始想成长的IT仔 2018-11-11 18:12
    关注

    mybatis里的sql语句写法跟数据库里的sql写法并不完全一致,所以要先去查找对应的mybatis

    评论

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗