Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Hex to Number

Re: Hex to Number

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: Mon, 03 Apr 2000 11:04:17 GMT
Message-ID: <8c9trb$kmi$1@nnrp1.deja.com>


In article <38E8535E.1A91AE9B_at_siemens.at>, Bob <bernhard.auer_at_siemens.at> wrote:
> Can anybody tell me how I can convert a Hex value (in VARCHAR2) in an
> equivalent Number value? (and reverse)
>
> Thanks
>
>

In Oracle8i, release 8.1 and up -- you can use the X format in to_number/to_char:

ops$tkyte_at_8i> select to_number( 'ABC', 'xxx' ) from dual;

TO_NUMBER('ABC','XXX')


                  2748

ops$tkyte_at_8i> select to_char( 2748, 'xxx' ) from dual;

TO_C



 abc

ops$tkyte_at_8i>

Prior to that, plsql can do it. See
http://osi.oracle.com/~tkyte/hexdec/index.html for a set of base conversion routines.

--
Thomas Kyte tkyte_at_us.oracle.com
Oracle Service Industries http://osi.oracle.com/~tkyte/index.html --
Opinions are mine and do not necessarily reflect those of Oracle Corp

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Apr 03 2000 - 06:04:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US