Thursday, March 3, 2011

What column type in Oracle can take full range of java double values

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?

From stackoverflow
  • 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

    unwind : 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.
    MSalters : Oracle's BINARY_DOUBLE does not store the IEEE754 value -0, Java does.
    Tony Andrews : What the heck is -0 as opposed to 0? ;-)
    Bloodboiler : 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.

0 comments:

Post a Comment