Mybatis报错:sql injection violation, syntax error: syntax error, expect RPAREN, actual FOR FOR

sql语句放在navicate中可以正常执行,但是在MyBatis中则报上述错误,sql语句如下:
SELECT
SUBSTR( a.date FROM 6 FOR 7 ) AS date,
a.consumption
FROM
(
SELECT
DATE_FORMAT( date( e.COLLECT_TIME ), '%Y-%m' ) AS date,
sum( e.PAP_R_I ) AS consumption
FROM
ec_electric_value e
WHERE
1 = 1
AND YEAR ( e.COLLECT_TIME ) = YEAR ( now( ) )
GROUP BY
date
) a
报错的是【SUBSTR】方法,即SUBSTR(XX FROM pos FOR len),MyBatis不支持这种写法,所以改成SUBSTR(XX, pos, len)即可,问题解决。

Mybatis报错:sql injection violation, syntax error: syntax error, expect RPAREN, actual FOR FOR最先出现在Python成神之路

版权声明:
作者:主机优惠
链接:https://www.techfm.club/p/19535.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>