[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

JDBC and NaN in where condition

Posted on 2000-03-27
3
Medium Priority
?
565 Views
Last Modified: 2008-02-26
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 ?

0
Comment
Question by:jguy
3 Comments
 
LVL 1

Expert Comment

by:computerpunk
ID: 2662900
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 .
0
 

Author Comment

by:jguy
ID: 2663140
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).
0
 
LVL 2

Accepted Solution

by:
azawawi earned 300 total points
ID: 2677978
check if Sybase uses IEEE 754 as Java, if not... then try converting NaN into another special value (like null) for example...
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question