Post

MyBatis 대소문자 구분 없이 like 검색

1. SQL문

1) UPPER

1
2
3
SELECT *
FROM 테이블명
WHERE 컬럼 LIKE UPPER(검색어)

2) LOWER

1
2
3
SELECT *
FROM 테이블명
WHERE 컬럼 LIKE LOWER(검색어)

2. MyBatis 설정

1) Oracle

1
column like '%' || UPPER(#{keyword}) || '%'

2) PostgreSQL, MySQL

1
column like CONCAT('%', UPPER(#{keyword}), '%')

3) MS-SQL

1
column like '%' + UPPER(#{keyword}) + '%'
This post is licensed under CC BY 4.0 by the author.