I have to build a IN condition using MyBatis where have to pass a list of PARENT_VALUES
to be obtained based on the foreach loop below....
I tried but u
Your Select statement would like something like this
<select id="getNameAgeDetails" parameterType="map" resultMap="someResultMap">
SELECT P.NAME, P.AGE
FROM PERSON_DETAILS P
WHERE
SOMECOLUMN is NULL
AND DATA IN
(SELECT DATA
FROM PARENT_TABLE
WHERE PARENT_VALUE IN
<FOREACH item="item" index="index" collection="list" separator="," open="(" close=")">
${item}
</FOREACH>
)
ORDER BY P.NAME
FETCH
FIRST 10 ROW ONLY
</select>
I agree with Karthik Prasad and if you remove CDATA and have sth like
a_column>=6 AND b_column<10
you must do the XML escape just as below:
a_column >= 6 AND b_column < 10