List:General Discussion« Previous MessageNext Message »
From:Paul McNeil Date:June 7 2004 2:44pm
Subject:Select double value
View as plain text  
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!

Thread
Select double valuePaul McNeil7 Jun
  • RE: Select double valueDean Urmson7 Jun
  • Re: Select double valueMichael Stassen7 Jun
RE: Select double valueVictor Pendleton7 Jun
Re: Select double valueMichael Stassen7 Jun