Oracle CONCAT number of fuzzy query parameters are invalid

When using MyBatis operation of an Oracle database, originally written fuzzy query suddenly found right in MySql code, an error in Oracle, the number of parameters is invalid

<if test="empId!=null and empId!=''">
    and e.empId like CONCAT('%',#{empId},'%')
</if>

Exception information;

 

 

After that Oracle CONCAT function After a review of several materials is not as stitching supports three parameters MySql, SQL statements need to be amended as follows:

and e.empId like CONCAT(CONCAT('%',#{empId}),'%')

or

and e.empId like '%' || #{empId} ||'%';

 

Oracle only more effective!

PS:

  The foundation is really important! !

  The code should be simpler and more knocking several times, so that it "likely" become a part of you "!

Guess you like

Origin www.cnblogs.com/arebirth/p/excoconcat.html