在学习盖老师的文章时,发现
这个数值百思不得其解,后来发现通过 utl_raw.cast_to_number这个逆函数来转换:
1.1 整数
SQL> select dump(175185, 16) from dual;
DUMP(175185,16)
------------------------
Typ=2 Len=4: c3,12,34,56
SQL> select utl_raw.cast_to_number('c3123456') value from dual;
VALUE
----------
175185
加个replace函数处理起来更方便。
SQL> select utl_raw.cast_to_number(replace('c3,12,34,56', ',')) value from dual;
VALUE
----------
175185
1.2 小数
SQL> select dump(1751.85, 16) from dual;
DUMP(1751.85,16)
------------------------
Typ=2 Len=4: c2,12,34,56
SQL> select utl_raw.cast_to_number(replace('c2,12,34,56', ',')) value from dual;
VALUE
----------
1751.85
2 转换字符串
SQL> select dump('oracle tom', 16) a from dual;
a
--------------------------------------------
Typ=96 Len=10: 6f,72,61,63,6c,65,20,74,6f,6d
SQL> select utl_raw.cast_to_varchar2(replace('6f,72,61,63,6c,65,20,74,6f,6d', ',')) value from dual;
VALUE
--------------------------------------------------------------------------------
oracle tom