YoTo Blog

MyBatis Like Grammar


MyBatis Like

The usage method is different for each DB type.
Use it according to the DB you are using.


Usage Method

Oracle

SELECT * FROM TEST
WHERE LIKE '%' || #{value} || '%'

MySql & MariaDB

SELECT * FROM TEST
WHERE LIKE CONCAT('%', #{value}, '%')

MsSql

SELECT * FROM TEST
WHERE LIKE '%' + #{value} + '%'