当前位置:网站首页>模糊查询时报错Parameter index out of range (1 > number of parameters, which is 0)
模糊查询时报错Parameter index out of range (1 > number of parameters, which is 0)
2022-07-03 02:56:00 【一尾流鸢cd】
以下为报错信息
select * from user where uid like '%?%'
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3288)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3272)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3314)
at com.mysql.jdbc.PreparedStatement.setInt(PreparedStatement.java:3258)
at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3533)
预编译赋值可能出现的错误:
- 指定的赋值位置错误,即
parameterIndex参数错误,此参数的值是从1开始- 赋值数量不够
在保证sql语句没有错误,且使用预编译赋值无错误的情况下:
…
有可能是sql语句中使用的字符拼接方式不正确,小编就是这样,刚开始使用单引号发生上面所述的异常。
解决方法:
改变sql语句的拼接方式,小编改成了select * from user where uid like concat('%',?,'%')
边栏推荐
- Random shuffle note
- js根据树结构查找某个节点的下面的所有父节点或者子节点
- The core idea of performance optimization, dry goods sharing
- Force deduction ----- the minimum path cost in the grid
- Add automatic model generation function to hade
- C语言中左值和右值的区别
- Change cell color in Excel using C - cell color changing in Excel using C
- How to select the minimum and maximum values of columns in the data table- How to select min and max values of a column in a datatable?
- tensor中的append应该如何实现
- Strategy application of Dameng database
猜你喜欢

Add automatic model generation function to hade

Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception

Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)

Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers

Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
![[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)](/img/e5/c01f760b07b495f5b048ea367e0c21.gif)
[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)

从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
![[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling](/img/c3/b9a614001f80345a5c1cb3c68ab27c.jpg)
[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling

The Linux server needs to install the agent software EPS (agent) database
![[fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)](/img/6a/ae44ddb090ce6373f04a550a15f973.jpg)
[fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)
随机推荐
Wechat - developed by wechat official account Net core access
Variable declarations following if statements
二维格式数组格式索引下标连续问题导致 返回json 格式问题
Pytest (6) -fixture (Firmware)
Le processus de connexion mysql avec docker
Can netstat still play like this?
TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
[fluent] listview list (map method description of list set | vertical list | horizontal list | code example)
基于can总线的A2L文件解析(2)
The solution of "the required function is not supported" in win10 remote desktop connection is to modify the Registry [easy to understand]
《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
处理数据集,使用LabelEncoder将所有id转换为从0开始
The difference between left value and right value in C language
【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
【富瀚6630编码存录像,用rtsp服务器及时间戳同步实现vlc观看录像】
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
[translation] the background project has joined the CNCF incubator
[translation] modern application load balancing with centralized control plane
Source code analysis | resource loading resources
[C language] MD5 encryption for account password