ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <steven...@gmail.com>
Subject Dynamic sql statement
Date Thu, 26 Jan 2006 17:54:03 GMT
Dear all,

I want to run one dynamic query like this:

select * from cto.personinfovo where id=#id# and area=#area#

But for "area" field, is has two conditions, one is for "ALL" and one is the
input value, the ibatis XML file is like this and it's not working well,

  <select id="selectALL" parameterClass="PersoninfoPO"
       <![CDATA[ select * from cto.personinfovo ]]>
    <dynamic prepend="where">
        <isNotEmpty prepend="and" property="id">
             <![CDATA[ (id=#id#) ]]>
 <isNotEmpty prepend="and" propery="area>
 (    <![CDATA[ (area=#area#) ]]>
    <isEqual prepend="or" property="area" compareValue="ALL">
             <![CDATA[(area in ('SC','EC','CC','NC','NE','SW','NW'))]]>
           </isEqual>  )

Could any one give me the help?

Thanks so much!

View raw message