When using Oracle database for fuzzy query, The console error is shown in the following figure:The reason is that I typed too fast and the grammar was wrong. The correct way to write it is pd.code like concat(concat('%',#{keyword}),'%') java.sql.SQLSyntaxErrorException: ORA-00909: invalid number of parameters I encountered this exception when using MyBatis for multi-parameter fuzzy query. I looked at the print log and found that the exception occurred after pre-compilation and when inserting actual parameters.
Exception message: The number of parameters is invalid. Checked the SQL statement select role_id, role_name, note from t_role where role_name like concat('%', ?, '%') and note like concat('%', ?, '%') I found that the problem occurred in concat. concat is a function that connects two strings. Here, three are connected. Change the SQL to two nested concats. <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> SummarizeThe operation was successful! The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM! You may also be interested in:
|
<<: Docker builds Redis5.0 and mounts data
>>: Detailed explanation of flex layout in CSS
1. Use basic text elements to mark up content Fir...
Table of contents The cause of the incident Anato...
For example, if I have a Jenkins server in my int...
Text shadow text-shadow property effects: 1. Lowe...
First look at the effect: Code: 1.html <div cl...
The specific method is as follows: CSS Code Copy ...
On a whim, I wrote a case study of a small ball b...
Learn about similar methods for getting character...
Table of contents 1. Preparation 2. Decompression...
MySQL replace and replace into are both frequentl...
Plot Review In the previous article, we analyzed ...
1. Introduction Today a colleague asked me how to...
This article shares the specific code of JS to ac...
Initialize Data DROP TABLE IF EXISTS `test_01`; C...
I started working on my final project today, but ...