You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by el...@accenture.com on 2005/04/29 11:11:53 UTC

How to obtain results looking for a NULL

Hello;
 
I'm trying to get results from a table, but I can't search for a col = null or col = 'value'.
 
 
This is my sqlmap statement.
 
 
<statement id="getME" parameterClass="com.MEQuery" resultClass="com.MEQuery">

SELECT A, B FROM ME

<dynamic prepend="WHERE">

<isNotEmpty prepend="AND" property="A"> A = #A#</isNotEmpty>

<isNotEmpty prepend="AND" property="B">B = #B#</isNotEmpty>

<isNull prepend="AND" property="B"> B IS NULL </isNull> 

</dynamic>

</statement>

 
 
 
Anybody can help me?
Thanks.
 
Eloy García-Borreguero Melero
CustomerWorks Europe S.L.
eloy.garcia.b@accenture.com
Tlf. 944 06 22 00 (Ext. 439)
Tlf. 944 04 17 32
 


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

Re: How to obtain results looking for a NULL

Posted by Brandon Goodin <br...@gmail.com>.
Just change your prepend to an OR when searching for NULL.

<isNull prepend="OR" property="B"> B IS NULL </isNull> 

On 4/29/05, eloy.garcia.b@accenture.com <el...@accenture.com> wrote:
>  
> Hello; 
>   
> I'm trying to get results from a table, but I can't search for a col = null
> or col = 'value'. 
>   
>   
> This is my sqlmap statement. 
>   
>   
>  
> 
> <statement id="getME" parameterClass="com.MEQuery"
> resultClass="com.MEQuery"> 
> 
> SELECT A, B FROM ME 
> 
> <dynamic prepend="WHERE"> 
> 
> <isNotEmpty prepend="AND" property="A"> A = #A#</isNotEmpty> 
> 
> <isNotEmpty prepend="AND" property="B">B = #B#</isNotEmpty> 
> 
> <isNull prepend="AND" property="B"> B IS NULL </isNull> 
> 
> </dynamic> 
> 
> </statement> 
>   
>   
>   
> Anybody can help me? 
> Thanks. 
>   
>  
> Eloy García-Borreguero Melero 
> CustomerWorks Europe S.L. 
>  
>  
>  
> eloy.garcia.b@accenture.com 
>  
> Tlf. 944 06 22 00 (Ext. 439) 
>  
> Tlf. 944 04 17 32 
>  
> 
> 
> 
> 
> This message is for the designated recipient only and may contain
> privileged, proprietary, or otherwise private information. If you have
> received it in error, please notify the sender immediately and delete the
> original. Any other use of the email by you is prohibited.

Re: How to obtain results looking for a NULL

Posted by Brice Ruth <bd...@gmail.com>.
Does it work when you use straight JDBC, with the parameterClass that you're 
passing in being used to populate your prepared statement?

On 4/29/05, eloy.garcia.b@accenture.com <el...@accenture.com> wrote:
> 
> Hello;
>  I'm trying to get results from a table, but I can't search for a col = 
> null or col = 'value'.
>   This is my sqlmap statement.
>    
> <statement id="getME" parameterClass="com.MEQuery" resultClass="com.
> MEQuery">
> 
> SELECT A, B FROM ME
> 
> <dynamic prepend="WHERE">
> 
> <isNotEmpty prepend="AND" property="A"> A = #A#</isNotEmpty>
> 
> <isNotEmpty prepend="AND" property="B">B = #B#</isNotEmpty>
> 
> <isNull prepend="AND" property="B"> B IS NULL </isNull> 
> 
> </dynamic>
> 
> </statement>
>    Anybody can help me?
> Thanks.
>   *Eloy García-Borreguero Melero*
> CustomerWorks Europe S.L.
>   eloy.garcia.b@accenture.com
>  Tlf. 944 06 22 00 (Ext. 439)
>  Tlf. 944 04 17 32
>  
> This message is for the designated recipient only and may contain 
> privileged, proprietary, or otherwise private information. If you have 
> received it in error, please notify the sender immediately and delete the 
> original. Any other use of the email by you is prohibited.
> 



-- 
Brice Ruth
Software Engineer, Madison WI