Hello,
When using other Database Drivers (like postgres) this is supported.
When suggesting Derby doesn't, what are the alternatives for my problem?
I really need to use it in the form of PreparedStatement,
like "select * from table where value = ?",
because we are using select statement with more than 6 parameter-values.
In what ways is the setNull function usefull ?
When trying to solve my problem, in many examples I found :
if (value == null)
ps.setNull(1, Types.VARCHAR);
else
ps.setString(1, value);
Thanks !
-------
Marieke Vandamme <[EMAIL PROTECTED]> 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
| **** DISCLAIMER **** http://www.tvh.be/newen/pages/emaildisclaimer.html "This message is delivered to all addressees subject to the conditions set forth in the attached disclaimer, which is an integral part of this message." |
