0 Replies Latest reply: Aug 30, 2012 1:09 PM by tem RSS

    OCI handing of BINARY_DOUBLE

    tem
      Could someone confirm that using SQLT_FLOAT with 8 bits to write a double-precision value from C into an Oracle 11.2 table column defined as BINARY_DOUBLE goes through a conversion to Oracle NUMBER datatype? This is my experience.

      If so, is using SQLT_BDOUBLE the appropriate choice to avoid conversion to NUMBER?

      Page 3-5 of the OCI Programmer's Guide

      http://docs.oracle.com/cd/E14072_01/appdev.112/e10646.pdf

      includes SQLT_FLT as a host variable that can be bound to BINARY_FLOAT, but doesn't indicate whether a conversion to NUMBER occurs. However, page 3-11 includes the Note: "You may receive a round-off error when converting between FLOAT and NUMBER." What it doesn't mention is that the range of numbers for 8 bit FLOAT (when converted to NUMBER) becomes limited to that of NUMBER (e.g. -1e87 to 1e127 instead of the expected -1e308 to 1e308).


      Also, in the JDBC world there's a useful flag called "SetFloatAndDoubleUseBinary", as shown in page 4-16 of

      http://docs.oracle.com/cd/E14072_01/java.112/e10589.pdf

      that when set true causes binary transfer, thereby avoiding conversion to NUMBER. Is there anything similar in OCI?

      Edited by: tem on Aug 30, 2012 11:09 AM