Oracle: How do I convert hex to decimal in Oracle SQL?

前端 未结 4 568
孤独总比滥情好
孤独总比滥情好 2020-12-03 05:02

How do I convert hexadecimal to decimal (and back again) using Oracle SQL?

4条回答
  •  难免孤独
    2020-12-03 05:32

    Starting in Oracle8i, the TO_CHAR and TO_NUMBER functions can handle conversions from base 10 (decimal) to base 16 (hexadecimal) and back again:

    SQL> select to_char(123,'XX') to_hex, 
    2    to_number('7B','XX') from_hex   
    3   from dual  
    4  /   
    TO_     FROM_HEX
    ------  -----------------
    7B     123
    

    source

提交回复
热议问题