SQL模糊查询报:ORA-00909:参数个数无效问题的解决
16lz
2021-12-10
用oracle数据库进行模糊查询时,
控制台报错如下图所示:
原因是因为敲的太快,语法写错了
正确的写法是
pd.code like concat(concat('%',#{keyword}),'%')
用MyBatis进行多参数模糊查询的时候遇到这个异常,看了下打印日志,发现异常出在预编译之后,插入实参的时候。
==> Preparing: select role_id, role_name, note from t_role where role_name like concat('%', ?, '%') and note like concat('%', ?, '%')
2018-12-13 20:24:28,567 DEBUG [com.ss.learn.chapter3.mapper.RoleMapper.getRolesByIdAndNote] - ==> Parameters: 1(String), 1(String)
异常提示:参数个数无效。检查了下SQL语句
select role_id, role_name, note from t_rolewhere role_name like concat('%', ?, '%') and note like concat('%', ?, '%')
<select id="getRolesByIdAndNote" parameterType="map" resultType="role"> select role_id, role_name, note from t_role where role_name like concat(concat('%', #{roleName}), '%') and note like concat(concat('%', #{note}), '%') </select>
更多相关文章
- Android(安卓)模糊搜索rawquery bind or column index out of ra
- Android横向智能刷新框架-SmartRefreshHorizontal+ScrollView 实
- Android屏幕解锁图案破解
- Android(安卓)模糊效果 FastBlur
- android实现图片模糊背景效果
- android 一个SQLite数据库多个数据表的基本使用框架 (带demo)
- android背景模糊化处理
- Android(安卓)模糊搜索rawquery bind or column index out of ra
- Android(安卓)高斯模糊 RenderScript封装工具类