title: MyBatis, UPPER in a where condition
body: <p>I have to do a select query with a lot of parameters in MyBatis, I want to use the default mapper xml file structure and add an "UPPER(column_name) = ?" to the result converted query. How Can I do ?</p>
  
  <p>Here is my where clause</p>
  
  <pre><code>&lt;sql id="My_Select"&gt;
      &lt;where&gt;
          &lt;foreach collection="oredCriteria" item="criteria" separator="or"&gt;
              &lt;if test="criteria.valid"&gt;
                  &lt;trim prefix="(" prefixOverrides="and" suffix=")"&gt;
                      &lt;foreach collection="criteria.criteria" item="criterion"&gt;
                          &lt;choose&gt;
                              &lt;when test="criterion.noValue"&gt;
                                  and ${criterion.condition}
                              &lt;/when&gt;
                              &lt;when test="criterion.singleValue"&gt;
                                  and UPPER(${criterion.condition} #{criterion.value})
                              &lt;/when&gt;
                              &lt;when test="criterion.betweenValue"&gt;
                                  and ${criterion.condition} #{criterion.value}
                                  and
                                  #{criterion.secondValue}
                              &lt;/when&gt;
                              &lt;when test="criterion.listValue"&gt;
                                  and ${criterion.condition}
                                  &lt;foreach close=")" collection="criterion.value" item="listItem"
                                      open="(" separator=","&gt;
                                      #{listItem}
                                  &lt;/foreach&gt;
                              &lt;/when&gt;
                          &lt;/choose&gt;
                      &lt;/foreach&gt;
                  &lt;/trim&gt;
              &lt;/if&gt;
          &lt;/foreach&gt;
      &lt;/where&gt;
  &lt;/sql&gt;
  </code></pre>
  
  <p>and here is the complete select statement:</p>
  
  <pre><code>&lt;select id="mySelect" parameterType="myDataExample"
      resultMap="myResultMap"&gt;
      select
      &lt;if test="distinct"&gt;
          distinct
      &lt;/if&gt;
      &lt;include refid="my_Column_List" /&gt;
      from istanza_metadato
      &lt;if test="_parameter != null"&gt;
          &lt;include refid="My_Select" /&gt;
      &lt;/if&gt;
      &lt;if test="orderByClause != null"&gt;
          order by ${orderByClause}
      &lt;/if&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I always receive error like this one</p>
  
  <p>The error occurred while setting parameters</p>
  
  <p>...</p>
  
  <p>WHERE (  UPPER(id_metadato = ?) and UPPER(valore = ?) )</p>
  
  <p>I feel I'm near to the solution, but I can't find a way. Thanks to all</p>