[iBatis] in 구문처리

DB 2015. 7. 1. 17:24
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

<변수 셋팅>

iBatis 에서 IN 구문 처리시 파라미터 변수가 아래와 같이 되어있고 

SQL SELECT 시 이런 식으로는 SQL 인식이 되지 않는다. 오류도

뜨지 않는다.


String name = "('a', 'b', 'c')";


<![CDATA[

select *

from TEST

where NAME in #name#

]]>

IN 처리시 에는 아래와 같이 # 대신 $ 를 사용하여 인식가능 하도록 한다.


<![CDATA[

select *

from TEST

where NAME in $name$

]]>

 

 

 

<iBatis iterate>

ArrayList<String> searchWrdList = new ArrayList<String>();
searchWrdList.add("");
searchWrdList.add("");
.setSearchWrdList(searchWrdList);

 

private ArrayList<String> searchWrdList = null;

 

<![CDATA[ 컬럼명 IN ]]>
<iterate  property="searchWrdList" open="(" close=")" conjunction=",">
     #searchWrdList[]#
</iterate>

'DB' 카테고리의 다른 글

[Mysql] Mysql utf8 언어설정(캐릿터셋)  (0) 2015.12.17
[Tibero/Oracle] update join  (0) 2015.07.02
[Mysql] tinyint(1)  (0) 2015.06.23
[Oracle] TO_SINGLE_BYTE() & TO_TO_MULTI_BYTE()  (0) 2014.12.16
[Oracle] UNION & UNION ALL  (0) 2014.10.29
블로그 이미지

겐타쓰

,