This Set of routines is useful to communication badween various 'Bases' in Oracle:
create or replace function to_base (p_dec in number, p_base in number) return varchar2is l_str varchar2 (255) default NULL; l_num number default p_dec; l_hex varchar2 (16) default '0123456789ABCDEF'; begin if (p_dec is null or p_base is null) THEN RETURN NULL; END IF; IF (trunc (p_dec) <> p_dec or p_dec <0) THEN RAISE Program_ERROR; END IF; Loop L_Str: = Substr (L_HEX, MOD (L_Num, P_Base) 1, 1) || L_Str ; L_num: = trunc (l_num / p_base); exit when (l_num = 0); end loop; return l_str; end to_base; /