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
What is a tree in web design? Simply put, clicking...
Table of contents introduction Distinguish betwee...
Nowadays we often talk about Web2.0, so what is W...
Table of contents 1. What is front-end state mana...
Prerequisite: Mac, zsh installed, mysql downloade...
The W3C standardization process is divided into 7...
Table of contents Understanding SQL Understanding...
Recently, I need to use a lot of fragmented pictu...
Master-slave synchronization, also called master-...
HTML5 is the next version of the HTML standard. M...
Related Documents Part of this article is referen...
As shown below: select name from mysql.proc where...
I haven't used mysql on my computer for a lon...
This article shares the specific code for impleme...
Table of contents What is nginx 1. Download the r...