본문 바로가기
웹프로그래밍/Oracle or Sql

SQL mybatis if equals 숫자, 문자, 문자열 빈값 NULL 구문 체크

by Seras 2021. 10. 21.
반응형
SQL mybatis equals 숫자 문자 문자열 빈값 NULL 구문 체크

 

  • 문자
<!-- 문자 -->
<if test='"Y".equals(char)'>
</if>

<if test='char != null and char == "Y"'>
</if>
  • 숫자
<!-- 숫자타입 -->
<if test="chkEduClsfNo == 4">
WHERE 1=1
</if>
  • 빈값, NULL 체크
<!-- NULL, 빈값 체크 -->
<if test="breuNos != null and !breuNos.equals('')">
WHERE 1 = 1
</if>
  • 문자열 비교
<!-- 문자열 -->
<if test="mstCd != null and mstCd.equals('CD12345')">
WHERE 1=1
</if>

 

반응형