Float to hex conversion

Application A has a data type NUMBER and B has a data type BLOB. The data types cannot be changed since we don't have the source codes for both applications.
The data stored in application A is a float of negative value (--1.7029176). I need to convert it to hex (BFD9F934) and store it in application B to be able to use it.
Is there a way to code this in PL/SQL?

I guess you are looking for these conversion functions
SQL> select rawtohex(-1.7029176) from dual;
RAWTOHEX(-1.70
3E641F48542966
--" or "
SQL> select dump (-1.7029176,16 ) from dual;
DUMP(-1.7029176,16)
Typ=2 Len=7: 3e,64,1f,48,54,29,66

Similar Messages

  • DECIMAL = HEX CONVERSION PACKAGE 생성 SCRIPT

    제품 : SQL*PLUS
    작성날짜 : 2002-04-12
    DECIMAL <=> HEX CONVERSION PACKAGE 생성 SCRIPT
    ==============================================
    Purpose
    Oracle내에서는 여러가지 값을 HEX 값으로 보여주는 경우가 있다.
    이런 경우 DB내에서 decimal 값으로 변환하기 위한 방법을 알아보자.
    Explanation
    다음은 decimal <=> hexa 의 conversion을 위한 package 생성문으로서
    system user로 수행하여 사용한다.
    create or replace package support as
    function dectohex (a number) return varchar2;
    pragma restrict_references
    (dectohex, WNDS, WNPS, RNDS, RNPS);
    function hextodec (a varchar2) return number;
    pragma restrict_references
    (hextodec, WNDS, WNPS, RNDS, RNPS);
    end support;
    create or replace package body support as
    FUNCTION hextodec(a IN VARCHAR2) RETURN NUMBER IS
    x NUMBER := 0;
    y NUMBER;
    z VARCHAR2(1);
    BEGIN
    IF length(a) > 8 THEN
    RAISE invalid_number;
    END IF;
    FOR i IN 1..length(a) LOOP
    z := upper(substr(a,i,1));
    IF z = 'A' THEN
    y := 10;
    ELSIF z = 'B' THEN
    y := 11;
    ELSIF z = 'C' THEN
    y := 12;
    ELSIF z = 'D' THEN
    y := 13;
    ELSIF z = 'E' THEN
    y := 14;
    ELSIF z = 'F' THEN
    y := 15;
    ELSE
    y := to_number(z,9);
    END IF;
    x := x * 16;
    x := x + y;
    END LOOP;
    RETURN x;
    END hextodec;
    FUNCTION dectohex(a IN NUMBER) RETURN VARCHAR2 IS
    x VARCHAR2(8) := '';
    y VARCHAR2(1);
    z NUMBER;
    w NUMBER;
    BEGIN
    IF a > power(2,32) OR a < 0 THEN
    RAISE invalid_number;
    END IF;
    w := a;
    WHILE w > 0 LOOP
    z := w mod 16;
    IF z = 10 THEN
    y := 'A';
    ELSIF z = 11 THEN
    y := 'B';
    ELSIF z = 12 THEN
    y := 'C';
    ELSIF z = 13 THEN
    y := 'D';
    ELSIF z = 14 THEN
    y := 'E';
    ELSIF z = 15 THEN
    y := 'F';
    ELSE
    y := to_char(z);
    END IF;
    w := trunc(w / 16);
    x := concat(y,x);
    END LOOP;
    RETURN x;
    END dectohex;
    END support;
    drop public synonym support;
    create public synonym support for system.support;
    grant execute on support to public;

    FYI: The new xf86-video-intel (2.9) has just been released:
    http://article.gmane.org/gmane.comp.fre … xorg/40733
    According to the release announcement, the new driver fixes the backlight issue with KMS:
    * Add support for BACKLIGHT property when using kernel modesetting
      (KMS). This allows backlight adjustment with programs such as
      "xbacklight -set <percentage>" or "xrandr --set BACKLIGHT <value>".

  • Character to hex conversion

    Hi,
    How can i convert character into hex string , for example if i have the data as "testing data", how can i get the hex coded output? Ive tried out using first string to number vi and thennumber to hex conversion vi but i get the answer as 0, can u help me in this?
    In short my data is " testing1234okokok" , i want a hex coded output which would be something as  "AD87BA......."
    Please help
    From Subhash

    What coercion dots? There are no coercion dots even without the loop:
    Message Edited by smercurio_fc on 02-13-2008 03:12 PM
    Attachments:
    Example_VI.png ‏1 KB

  • Interger to hex conversion ???

    Hi
    Is there a easy way to make interger (unsigned 32 bit ) to HEX
    conversion ??

    Kristian,
    It depends on what you want to do with the hex conversion. To view a
    number in hex in a control, right click on the control, select Format &
    Precision. As long as the format is set to numeric, you can select
    between decimal, hex, octal and binary from the other drop-down list.
    If you want to change an unsigned 32-bit number to a hex value to be
    written to a file, you can use the String->Format Into String VI. Wire
    your U32 into input 1, and set the format string to %4x (which will show
    a 4 digit hex value). The output will be a string which contains the
    hex value.
    Hope that helped.
    Mark
    In article <[email protected]>,
    [email protected] wrote:
    >
    >
    > Hi
    >
    > Is there a easy way to make interger (unsigned 32 bit ) to H
    EX
    > conversion ??
    >
    Sent via Deja.com http://www.deja.com/
    Before you buy.

  • Problem with EPC URI to Hex conversion

    Hi Forum,
    I am getting strange EPC URI to hex conversion result in tx:/ain/http_test . Could you please confirm if this result is not expected.
    1.URI : urn:autoid:tag:sgtin-96:3.0066800.054321.70     
    hex is :  30740413C00000D431000000
    2.URI:  URN:AUTOID:TAG:SGTIN-96:3.0066800.054321.71
    hex is: 30740413C00000D431000000
    thus is both case HEX is same!!!
    i am using EPC_1.24  as active EPC version.
    could you please suggest some round about way.
    thanks in advance,
    regards,
    Ashit

    hi,
    i think problem is with EPC_1.24. i changed to
    EPC_1.27
    and it works fine.
    regards,
    Ashit

  • Floating point format conversions

    Hi All,
    I have a binary file that has 8 byte floats in it written in VAX D floating point format. It also has 4 byte integers in it. I have to read this file on a Sun Sparc. To get the correct value of the integers I just swap the bytes around and write out the int value, so bytes 0123 get rearranged to be 3210 and then I use that as my int. I tried that with the doubles, reorder bytes 01234567 to 76543210 and then write out the double value but I don't get the value that was stored.
    I read 8 bytes from the file, I'm supposed to get 512.0 but I get garbage.
    The hex dump of the file shows: 0045 0000 0000 0000
    I can't come up with a way to turn that into 512.0
    Another one is 360448.0 with hex dump: b049 0000 0000 0000
    Can anyone show me how to manipulate these bits/bytes to get the correct values?
    Thanks

    Hi Legosa,
    Thanks for looking for a solution for me. The linkhttp://nicmos2.as.arizona.edu/thompson/kfocas/vax2sun.c
    has a C implementation of exactly what I need and has saved me a lot of time and work. Translation to Java will have to use bit shifting I think, the C unions make for a nice implementation.
    I also have to read PC and Cray generated files on my Sun.
    I have found that, like the Vax, Intel x86 including pentium are all little endian and use IEEE so I'm guessing that I just have to do the byte swapping to translate from PC to Sun.
    Crays are Big endian so I don't need byte swapping but I do need to do some manipulation of the exponent and the mantissa.
    Do you know where I might find code that others have done for PC to Sun and Cray to Sun conversions of integers, floats and doubles?
    BTW, for those who may read this later, the solution in vax2sun.c isn't quite right, the author forgot to use the least significant 32 bits and lost 3 bits in the middle but it is very close. To make it closer you have to change the vax2sun.c code a little.
    Replace mantissa and lomant with
    In union ieeebuf
    int mantissa1:20
    int mantissa2:3
    int mantissa3:29
    In union vaxbuf
    int mantissa1:20
    int mantissa2:3
    int mantissa3:29
    int lost_bits:3
    In the code replace d.mantissa = v.mantissa/8 with:
    d.mantissa1 = v.mantissa1
    d.mantissa2 = v.mantissa2
    d.mantissa3 = v.mantissa3
    My few tests showed this gave very good results. The lost_bits are lost because ieee needs 3 more bits for its exponent so it doesn't have room for all of the vax mantissa bits. A little bigger range means a little less precision.

  • Float to string conversion

    import java.lang.String;
    import java.lang.Integer;
    import java.lang.Float;
    import java.util.Hashtable;
    import java.util.Enumeration;
    public class VenkatCart {
    protected Hashtable items = new Hashtable();
    public VenkatCart() {
    public void addItem(String idk,int ic,int size,float rate,int qty) {
    String item[]={idk,Integer.toString(ic),Integer.toString(size),Float.toString(rate),Integer.toString(qty)};
    if (items.containsKey(idk)) {
         String tmpItem[] = (String[])items.get(idk);
         int tmpQuant = Integer.parseInt(tmpItem[4]);
         qty += tmpQuant;
         tmpItem[4] = Integer.toString(qty);
    else {
         items.put(idk,item);
    // get an Enumeration to the list of items in the shopping cart
    public Enumeration getEnumeration() {
    return items.elements();
    // get the total cost of all of the items currently in the shopping cart
    public float getCost() {
    Enumeration enum = items.elements();
    String tmpItem[];
    float totalCost = 0.0f;
    while (enum.hasMoreElements()) {
         tmpItem = (String[])enum.nextElement();
         totalCost += (Integer.parseInt(tmpItem[4]) * Float.parseFloat(tmpItem[3]));
    return totalCost;
    // get the total number of items currently in the shopping cart
    public int getNumOfItems() {
    Enumeration enum = items.elements();
    String tmpItem[];
    int numOfItems =0;
    while (enum.hasMoreElements()) {
         tmpItem = (String[])enum.nextElement();
         numOfItems += Integer.parseInt(tmpItem[4]);
    return numOfItems;
    When I call the method "getCost()" from a jsp program, I get the error message
    Error: java.lang.Float: method parseFloat(Ljava/lang/String;)F not found has been reported.
    I think the mistake is in conversion.
    Please help me.
    My thanks in advance.

    Why don't you try the following:
    Float tmpFloat=new Float(tmpItem[3]);
    totalCost += (Integer.parseInt(tmpItem[4]) * tmpFloat.floatValue();
    Justyna

  • Numeric to hex conversion

    Hi
    i am new to labview. i have implemented a controller circuit and serially communicating with using lab view in that i am using a numeric value and converting it to hex using numeric to hex string and receiving that on port 1 of controller but that is displaying ASCII values of my number though i have converted it in hex in block diagram of labview. 
    Attachments:
    serial comm.vi ‏16 KB

    Hi
    I have problem in labview to my hardware communication. when i am using (testing) code for my controller and using CS100FULL.vi then i get whatever data i send on assigned ports. But i want total 12 bit data to deal with and thats to in hex form insted of ASCII so i do the necessary changes in controller code(testing1) and making change in vi also keeping width of decimal to hex string conversion block 3. but i wont get any data at port.
    Please please suggest me whwrw i am making mistakes because in keil this code runs properly and i get at desired data at ports in simulator but when i am loding it in controller it won't work with labview but when i am using hyper terminal it communicate properly and i get data at port 0&1 that
    means i am doing mistake in vi so please suggest me solution and mistakes i am making in my vi.
    Thank you
    Attachments:
    testing.txt ‏2 KB
    testing1.txt ‏1 KB
    CS100Full.vi ‏37 KB

  • Hex conversion problem... Please help

    Hi all,
    I need to convert a hex character representing a UTF-16 character to a hex string representing a UTF-8 character
    i.e
    String input ="0x0630"; //ARABIC LETTER THAL (UTF-16)
    I want the output to be a hex representation of the same charcter in UTF-8.
    Does anyone know the java code to do this?

    As BIJ001 already implied: There are no "UTF-8 characters" and "UTF-16 characters". There are Unicode characters and their respective UTF-8 and UTF-16 encodings.
    For example:
    "&#1584;" is the arabic Letter Thal. Its name in the Unicode standard is ARABIC LETTER THAL. Its is the Unicode codepoint (decimal) 1584. This is often written as U+0630 (note that this number is hexadecimal).
    The UTF-16 encoding of this letter is the 16bit word 0x0630 (the UTF-16 encoding of most common characters is identical to its codepoint, but that's not always the case!).
    The UTF-8 encoding of this letter are the two 8bit words 0xD8 0xB0.
    If you have the String "0x0630", then you can split the hexadecimal number from the String, parse it, interpret it as a char, and create a String from it. Then call getBytes("UTF-8") on it and you'll have a byte array containing the UTF-8 encoding of that character.
    [_The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)_|http://www.joelonsoftware.com/articles/Unicode.html] is a nice explanation as well.

  • Need Hex conversion to char for 4 digits.

    I need to read a file in and translate some of the characters into integers. I need the hex value from the character. Problem is, when using Cp850 which is the encoding of the file, some characters show as ? instead of the proper character.
    A simple output shows the problem where only 4 digit hex values will not appear correctly. You can view the character set and values at the following URL http://www.microsoft.com/globaldev/reference/oem/850.htm
    Here is a simple app to show the problem.
    public class EncodingTest {
         public static void main(String[] args) throws Exception {
              String encoding = "Cp850"; //args[ 0 ];
              byte[] b = new byte[256];
              for (int i = 0; i < 256; i++)
                   b[i] = (byte)i;
              byte c[] = new byte[1];
              String x = new String(b, encoding);
              for (int i = 0; i < x.length(); i++) {
                   c[0] = b;
                   if (x.charAt(i) != i)
                        System.out.println(i + " -> " + (int)x.charAt(i) + "->" + (new String(c, encoding)));
    How to I get character 176 for example to show correctly? I tried to post the output from the app but all of the characters showed as ?.

    Well, if you want to convert int or char values to hex, just do the following:
    Integer.toHexString(int value);
    Now, about your charset problem, I tried it and found out that you will definetly not be able to print strange characters in DOS.
    I'll show you my example, it might help you; it prints out good in my computer...
    public class EncodingTest {
        public static void main(String[] args) throws Exception {
            String encoding = "Cp850"; //args[ 0 ];
            byte[] b = new byte[256];
            for (int i = 0; i < 256; i++)
                b[i] = (byte) i;
            byte c[] = new byte[1];
            String x = new String(b, encoding);
            for (int i = 0; i < x.length(); i++) {
                c[0] = b;
    if (x.charAt(i) != i)
    System.out.println(i + " -> " + Integer.toHexString((int)x.charAt(i)) + "-> " + (int)x.charAt(i) + "->" + (char) i + "->" + (new String(c, encoding)));

  • Unicode to hex conversion

    Guys, I look at ASCII table given to me for Czech chars and hex value for character "á" is E1. But when I use rawtohex function to get hex value I get below output.
    WHY ?
    SQL> select rawtohex('á') from dual;
    C3A1
    How can I get value E1 ? Thanks

    My Oracle version is
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE     9.2.0.1.0     Production
    TNS for Solaris: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 - Production
    NLS settings are ---
    1* select * from v$nls_parameters
    SQL> /
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_CHARACTERSET EE8ISO8859P2
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXF
    F AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXF
    F AM TZR
    NLS_DUAL_CURRENCY $
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    Anything more I need to setup. Btw I dun understand yet very clearly difference between NLS_CHARACTER_SET and NLS_NCHAR_CHARACTERSET

  • Unicode hex conversion

    Hello, can anyone please tell me how to achieve the same effect on this website, http://mylanguages.org/converter.php , in pl sql or oracle sql? They have taken an arabic string and returned a (to my knowledge) hex value.
    Many Thanks

    Handle:  igwe   
    Status Level:  Newbie (15) 
    Registered:  Mar 11, 2008 
    Total Posts:  384 
    Total Questions:  148 (83 unresolved)  Do you ask so many difficult questions or don't you mark questions as answerd when they are?
    with inp as
    ( select 'سليم' str from dual
    union all select 'anton' from dual
    select ( select listagg( '&#' || to_number( utl_raw.substr( utl_i18n.string_to_raw( str, 'AL16UTF16' ), level * 2 - 1, 2 ), 'XXXX' ) || ';' ) within group ( order by level )
             from dual
             connect by level <= length( str )
    from inpEdited by: ascheffer on Mar 5, 2013 11:33 PM

  • Floating Point arithmetic conversion

    Hi Everyone,
    Can you tell me how to convert a floating point arithmetic field value to a currency field value.
    thanks,
    chan

    Hi,
    I hope simple move statement should work.
    MOVE l_float TO l_curr.
    Make sure that curr field has enough length.
    Thanks,
    Vinod.

  • Float to string conversion (E-\d)

    i'am creating a compiler that needs to convert float vaues to string values.
    if the float values become very small java produces an output as this: 9.8E-4
    is ther a way retrive 0.00098 instead of the computerized scientific notation?

    Try java.text.DecimallFormat:
    http://java.sun.com/docs/books/tutorial/java/data/decimalFormat.html

  • Floating to char conversion

    Hi,
    I am fetching the floating value (AUSP-ATFLV) and I am storing that value into local variable in my Program.  For example if AUSP-ATFLV contains value like 8.0000000000000000E+02 but I need to store this to 800 in my variable. So how to declare the variable I mean what type and what length I have to use for changing the above float value to 800. Please help me.
    Thanks.

    Hi Babji..
    You can declare a Variable of type P.
    DATA : V_PACK(10) TYPE P DECIMALS 2.
    DATA : V_FLOAT TYPE F VALUE '800'.
    MOVE V_FLOAT TO V_PACK.
    WRITE:/ V_FLOAT, V_PACK.
    <b>
    Reward if Helpful.</b>

Maybe you are looking for

  • Error on calling a BDC from web dynpro while it runs fine through FM.

    I have created a function module for calling transaction ima2n using a BDC. This function module runs as intended, if function module is executed using SE37. if I call the same function module from ABAP dynpro view, on some event. I get the below err

  • Regarding ers procedure

    Hi all, I was configured ers procedure for vendor as follows. 1. Auto ers indicator , gr based invoice indicator checked in vendor master purchasing data. 2. Maintain the info record for material and vendor combination , in this we maintain tax code.

  • Exchange mailbox creation for child domain

    Hi Friend,' I want to add a child domain,some thing like group.domain.com. We have an exchange 2013 in the network, my requirement is to create 50 users in the child domain and create mail accounts for this child domain users.  My main challenge is t

  • Help me with keyboard hotkeys

    I have a presario compaq CQ62-238DX notebook My laptop has built in keys for my f1,f2,f3,f4,f5,f6,f7,f8,f9,10,f11,f12. They all do random stuff that help new users. I want them gone and theres no simple setting where i can turn them off. I have to pr

  • HT4623 My iPod touch 5 can't install iOS 7. I need help

    I need help