db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: setNull in select doesn't work
Date Mon, 24 Jul 2006 09:45:08 GMT
Marieke Vandamme <marieke.vandamme@tvh.be> writes:

> Hello,
>
> We are trying to perform a select query to the Derby database with 
> PreparedStatement
>
> PreparedStatement ps = c.prepareStatement("select * from table where value 
> = ?");
> //several methods performed on statement (separately ofcourse)
> 1. ps.setNull(1,Types.VARCHAR);
> 2. ps.setObject(1, null, Types.VARCHAR);
> 3. ps.setString(1, null) ;
>
> The table contains null values, but the resultset is empty for the 3 
> cases.

It doesn't return any rows because "value = null" does not evaluate to
true even when value in fact is null, in which case it evaluates to
unknown. "value is null" should work.

-- 
Knut Anders

Mime
View raw message