Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert RAW(8) as IEEE 754 double float to Oracle number in PL/SQL?

732740Nov 7 2009 — edited Nov 7 2009
Hi!

Does anyone know of a good and fast way to convert a 64 bit byte array, read as raw(8) in PL/SQL, to an Oracle number?
The byte array is a perfectly legal IEEE 754 double float.

All other languages have utility methods for this since it's a very common problem when reading/writing files to be read on other systems. The Oracle utl_raw package has some functionality for this, for binary_integers, but they do not work for me here.

I've found a fairly good mathematical script for it, but since it involves BITAND 0xfffff I can't use it in PL/SQL since Oracles built-in bitand-method only takes binary_integer as argument, and 0xfffff is larger than the max binary_integer.

Anyone?

Something tells me that there should be an internal function for this somewhere in the DB..

PLEASE NOTE: I'm using Oracle 9i!

PS. Please, do not tell me to do this in Java or Pro*C or some other language. I want it clean and simple in PL/SQL.

Edited by: user12183994 on 2009-nov-07 04:09

Edited by: user12183994 on 2009-nov-07 13:43
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 5 2009
Added on Nov 7 2009
11 comments
1,526 views