views:

1192

answers:

1

What column type in Oracle 10g can be used to store any value of java double up to and including Double.MAX_VALUE and Double.MIN_VALUE?

+2  A: 

From the Oracle SQL Reference:

The NUMBER datatype stores zero as well as positive and negative fixed numbers with absolute values from 1.0 x 10^-130 to (but not including) 1.0 x 10^126.

It looks like you may need BINARY_DOUBLE:

Maximum positive finite value: 1.79769313486231E+308

Minimum positive finite value: 2.22507485850720E-308

Tony Andrews
The docs say: "A constant holding the largest positive finite value of type double, (2-2**52)·2**1023". I use ** to mean exponentiation. Entering this expression into Windows calculator gives 1,797693134862315708145274237317e+308.
unwind
Oracle's BINARY_DOUBLE does not store the IEEE754 value -0, Java does.
MSalters
What the heck is -0 as opposed to 0? ;-)
Tony Andrews
I thought that would be it. For some reason I got oracle jdbc driwer
Bloodboiler
.. to throw an exception when inserting close to max/min values.
Bloodboiler