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. Introduction MySQL locks can be divided into g...
describe Returns the time interval between two da...
Preface: The Linux host is relatively easy to han...
1. Check the database time zone show variables li...
Table of contents Overview Type Assertions in syn...
I've been learning Docker recently, and I oft...
Preface The notification bar component is a relat...
A system administrator may manage multiple server...
This article example shares the specific code of ...
This article introduces several methods of implem...
The principle is to first write a div with a butt...
1. Basic use of firewalld start up: systemctl sta...
Table of contents 1. TypeScript is introduced int...
Introduction to structural pseudo-class selectors...
Table of contents Preface Quick Review: JavaScrip...