当前位置:网站首页>模糊查询时报错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('%',?,'%')
边栏推荐
- JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
- Add MDF database file to SQL Server database, and the error is reported
- Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
- Practice of traffic recording and playback in vivo
- Cron表达式介绍
- [leectode 2022.2.15] lucky numbers in the matrix
- Your family must be very poor if you fight like this!
- [error record] the parameter 'can't have a value of' null 'because of its type, but the im
- [Fuhan 6630 encodes and stores videos, and uses RTSP server and timestamp synchronization to realize VLC viewing videos]
- The process of connecting MySQL with docker
猜你喜欢

Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
![[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)](/img/65/c1fe95f8c391394f7ff1b75c7d75b6.jpg)
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)

"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b

The process of connecting MySQL with docker

The Linux server needs to install the agent software EPS (agent) database
![[translation] modern application load balancing with centralized control plane](/img/b0/22e9bf098d580b2af67255ddcdc0d5.jpg)
[translation] modern application load balancing with centralized control plane

How to change the panet layer in yolov5 to bifpn

I2C 子系统(三):I2C Driver

Practice of traffic recording and playback in vivo
![[shutter] banner carousel component (shutter_wiper plug-in | swiper component)](/img/a6/5c97ef3f34702b83ebf0511501d757.gif)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
随机推荐
左连接,内连接
一文带你了解 ZigBee
Force freeing memory in PHP
Xiaodi notes
Yiwen takes you to know ZigBee
Process the dataset and use labelencoder to convert all IDs to start from 0
迅雷chrome扩展插件造成服务器返回的数据js解析页面数据异常
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
I2C subsystem (III): I2C driver
Add MDF database file to SQL Server database, and the error is reported
《MATLAB 神经网络43个案例分析》:第43章 神经网络高效编程技巧——基于MATLAB R2012b新版本特性的探讨
Left connection, inner connection
Reset or clear NET MemoryStream - Reset or Clear . NET MemoryStream
I2C 子系统(四):I2C debug
Informatics Olympiad one general question bank 1006 a+b questions
Random Shuffle attention
超好用的日志库 logzero
Add automatic model generation function to hade
What is the way out for children from poor families?
Linear rectification function relu and its variants in deep learning activation function