Liam,

I know a great deal about oracle internals, Oracle stores "numbers" as you 
indicate in a bcd format. But It can be up to 22 bytes long. But usage in 
oracle proc/proc++/sql/plsql is really dependent upon your native conversion to 
host datatype.

The number storage formats betweend Sqlite and Oracle are totally different. I 
don't think there is much your going to be able to do since the storage is 
different, most likely the precision is also going to be different and hence 
the outputs.

Maybe you could implement a deviation check in your sqlite code. If the number 
produced fromsqlite matches oracle within a range +/- some number. Then it is 
considered equal.

Also as your article implies you could modify the oracle data type to be a 
binary_float or binary_double which would store the value in a "native" ieee 
format instead of the NUMBER (which is more accurate).

Another thought: Role your own NUMBER data type !!! Create a function inside 
sqlite that would basically implement an oracle Number representation. This 
should then produce exact match to oracle (in theory). You could use a text 
field or blob field to store the number datatype. Then apply your conversion 
function to it!

HTH,
Ken



Liam Healy <[EMAIL PROTECTED]> wrote: I am porting a numerical application from 
Oracle to SQLite.  For the
most part, I have been successful, but there are slight disagreements
in the floating point number results.  I have traced this back and
found a problem.  According to
http://articles.techrepublic.com.com/5100-22_11-5224536.html, Oracle
by default stores floats as binary-coded decimal (BCD), and not
IEEE754 binary.  SQLite on the other hand does
http://www.sqlite.org/datatype3.html: "REAL. The value is a floating
point value, stored as an 8-byte IEEE floating point number."  For the
results of the application, it makes no difference how the numbers are
stored -- the differences in the 15th significant figure are
irrelevant.  However, I would like to insure that there no
disagreements in the way the two applications operate (other than the
storage of floating point numbers), and for that I temporarily need
exact agreement on input numbers.  I cannot change the Oracle
application, so I'm wondering if there's a wrapper or something I can
put around sqlite calls (or better, a mode that I can put sqlite in)
that will reproduce exactly the BCD format of Oracle.

Thanks for any guidance.

Liam
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to