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 ?

Who is Participating?
azawawiConnect With a Mentor Commented:
check if Sybase uses IEEE 754 as Java, if not... then try converting NaN into another special value (like null) for example...
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 .
jguyAuthor Commented:
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).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.