Base Conversion Routines
This set of routines is useful to convert between various 'bases' in Oracle. Once you install these functions, you will be able to perform operations such as:
SQL> select to_bin( 123 ) bin, to_hex( 123 ) hex, to_oct( 123 ) oct from dual
2 /
BIN HEX OCT
--------------- --------------- ---------------
1111011 7B 173
SQL>
SQL> select to_dec( '1111011', 2 ) base2, to_dec( '7B' ) base16,
2 to_dec('173',8) base8
3 from dual
4 /
BASE2 BASE16 BASE8
---------- ---------- ----------
123 123 123
You may download the source for these routines here.