| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Does anyone know how to convert from decimal to hex???
Timothy C. Bracey wrote:
>
> I'm wokring on a project that requires me to have hex values. Currently they
> are stored as decimal. Does anyone know a way of converting from dec. to
> hex. without having to use or write some pro C code?
>
> (snip)
create or replace
function DEC_TO_HEX
(dec number) return varchar2 as
n number := dec;
rm number;
hex varchar2 (16);
begin
loop
for i in 0 .. 1
loop
rm := mod(n,16);
hex := concat(ch(rm),hex);
n := trunc(n/16);
end loop;
if n = 0 then exit; end if;
end loop;
return hex;
Hope this helps.
Chrysalis. Received on Fri Jun 20 1997 - 00:00:00 CDT
![]() |
![]() |