select to_number('19f','xxx') from dual;
----------------------
415
select to_number('f','xx') from dual;
-------------------
15
2.10进制转换为16进制
我们可以通过to_char函数转换:
select to_char(123,'xx') from dual;
----
7b
select to_char(4567,'xxxx') from dual;
-----
11d7
3.2进制转换为10进制
从Oracle9i开始,提供函数bin_to_num进行2进制到10进制的转换:
select bin_to_num(1,1,0,1) a,bin_to_num(1,0) b from dual;
A B
----- ----------
13 2
select bin_to_num(1,1,1,0,1) from dual;
BIN_TO_NUM(1,1,1,0,1)
---------------------
29