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: HEX2DEC

Re: HEX2DEC

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 31 Aug 2002 08:41:51 -0700
Message-ID: <akqo3v023qu@drn.newsguy.com>


In article <b7d19747.0208301545.186b3775_at_posting.google.com>, dlimato_at_hotmail.com says...
>
>Was wondering how to convert hex to decimal in oracle. I see there is
>hextoraw, rawtohex, reftohex etc... but no hextodec or dectohex.
>
>I have a VARCHAR2 column that stores info in hex and I want to convert
>to decimal and later parse it.
>
>Thanks in advance,

ops$tkyte_at_ORA920.US.ORACLE.COM> select to_number( 'A0FF', 'xxxx' ) from dual;

TO_NUMBER('A0FF','XXXX')


                   41215

ops$tkyte_at_ORA920.US.ORACLE.COM> select to_char(41215,'XXXX' ) from dual;

TO_CH



 A0FF

ops$tkyte_at_ORA920.US.ORACLE.COM>

and if your on really old software that doesn't support the XX format, see

http://asktom.oracle.com/~tkyte/hexdec/index.html

--
Thomas Kyte (tkyte@oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sat Aug 31 2002 - 10:41:51 CDT

Original text of this message

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