解决shardingsphere shardingsphere4.0使用like模糊搜索出现的问题

使用shardingsphere,运行时出现红色报错“no viable alternative at input “,下面还出现”SQLErrorCodes loaded:,[DB2,Derby,H2,HSQL,Informix,MS-SQL,Oracle,PostgreSQL,Sybase]。

怀疑是sql语句在 shardingsphere 解析后出现问题。一查果然是。

出问题的语句是这样写: select * from t_car like #{car_no}”%”。

改写成下面这样就没问题:

select * from t_car like concat(#{car_no}, ‘%’)

关注公众号“大模型全栈程序员”回复“小程序”获取1000个小程序打包源码。更多免费资源在http://www.gitweixin.com/?p=2627

发表评论

邮箱地址不会被公开。 必填项已用*标注