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 Float to Hexadecimal

MohammedImranJun 23 2017 — edited Jun 23 2017

Hi ,

I need to convert a Float value to Hexadecimal in oracle.

The logic already exists in Java which looks like

     1. Covert float value to integer using Float.floatToIntBits(flt) function.

     2. Convert Integer to Hexadecimal using Integer.toHexString(int) function.

For example float value -0.92945087 converted to hexadecimal gives "bf6df07e".

public class ReadDat {

public static void main(String[] args)

  {

  float flt = (float) -0.92945087;

  System.out.println("Decimal Value:"+Float.floatToIntBits(flt));

  System.out.println("Hexadecimal Value:"+Integer.toHexString(Float.floatToIntBits(flt)));

}

}

Can you please help on how can this be achieved in oracle.

Thanks,

Imran.

This post has been answered by Anton Scheffer on Jun 23 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2017
Added on Jun 23 2017
3 comments
1,498 views