Link to home
Start Free TrialLog in
Avatar of jguy
jguy

asked on

JDBC and NaN in where condition

I try to retrieve rows that include columns with an NaN value as Float.
I use preparedStatement.

ex : select c1,c2,c3 where c1 = ?

java code is like :

               ps = con.preparedStatement(select c1,c2,c3 where c1 = ?);
               ps.setObjet(1,new Float(Float.NaN);
               rs = ps.executeQuery();

I know that some rows match this case, but rs.next() return false

Can somebody help me ?

Avatar of computerpunk
computerpunk

Have you tried ps.setFloat() or setDouble() passing in the value.
Something like ps.setFloat(1,Float.NaN);
And besides that have you checked your SQL statement ?? YOu have forgotten your erm.. Table name .
Avatar of jguy

ASKER

I tried this solution yet with no succes. In fact, i think it is probably due to the bite value of the Float.NaN in java comparing to the his value on the database (I use Sybase).
ASKER CERTIFIED SOLUTION
Avatar of azawawi
azawawi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial