通常对dump出来的内容,不能直观了解到想要的信息。可以用utl_raw来实现。
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
不知道能否转换时间等数据类型。