Good morning to all.

I have a problem with a workaround but I wanted to know if others have run
into this.

Table DATA
Column strength [double]

When I select strength from DATA and the result is a non zero amount it
returns correctly

3.256498

however if it is a 0 amount I get

0.00000000

The problem is that in my java.sql.ResultSet.getDouble("strength") a zero
amount throws a number format exception.  SO, I placed a conditional....

SELECT
CASE
WHEN strength IS NULL OR strength = 0
THEN 0
ELSE
strength
END

This, however seems to truncate the result so that a zero return results in
0 BUT a return of 3.1236564 results in 3.  Bummer.  Finally I had to
restructure my conditional...

SELECT
CASE
WHEN strength IS NOT NULL AND strength != 0
THEN strength
ELSE
'0'
END

I feel that this type of data manipulation shouldn't need to be done.  Is
this a bug or normal for a return type of double?

Thanks.

Good days to all.


GOD BLESS AMERICA!
To God Be The Glory!


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to