Results 1 to 5 of 5

Thread: HEX datatype - Oracle Question

  1. #1
    Join Date
    May 2005
    Posts
    111

    HEX datatype - Oracle Question

    If I have a HEX string that I want to insert into a field\table is there a specific datatype I need to use?

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932

  3. #3
    Join Date
    May 2005
    Posts
    111
    What I really need is to tell Oracle that this string is really a hex string and allow Oracle to convert it as needed. Example:

    SELECT to_number('MY_HEX_STRING')
    FROM DUAL:

    The question is how do I tell Oracle that this is a HEX string?

  4. #4
    Join Date
    Apr 2009
    Location
    European Union
    Posts
    6
    Quote Originally Posted by ecka00 View Post
    What I really need is to tell Oracle that this string is really a hex string and allow Oracle to convert it as needed. Example:

    SELECT to_number('MY_HEX_STRING')
    FROM DUAL:

    The question is how do I tell Oracle that this is a HEX string?
    Here is something what can help you:

    http://niigata.cool.ne.jp/j8takagi/hex_to_num.txt
    ---
    Oracle Certified Associate Developer
    Data Integrator
    Database Software Tester

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can use TO_NUMBER with formatting, e.g.

    --convert to number
    select to_number('A','xxx') from dual

    --convert to hex
    select to_char(10,'x') from dual;
    select to_char(10,'X') from dual;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •