通常對dump出來的內容,不能直觀瞭解到想要的資訊。可以用utl_raw來實現。
1 轉換數字
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
不知道能否轉換時間等資料類型。