Re: Hexadecimal Conversion In PL/SQL

From: Brian Membrey <horsemth_at_mel.switch.net.au>
Date: 1997/02/14
Message-ID: <01bc1a0a$655e3840$1fa966cb_at_default>#1/1


There are standard SQL conversion functions which will do this .... eg

    select rawtohex(chr(27)) hex from dual ;

   HEX



  1B

BUT when I try a similar statement in a PL/SQL block

  hex := rawtohex( chr(27) ) ;

I get "ORA-06502: PL/SQL: numeric or value error" I've tried splitting the rawtohex and chr functions to separate statements and all sorts of other things to no avail. Yet if I use a SELECT ...

 select rawtohex (chr(27)) into hex from dual ;

then everything's fine. But surely there must be a way to convert without having to issue a database call ??????

Igor Keselman <Igor.Keselman_at_ab.com> wrote in article <33036826.5B86_at_ab.com>...
> Hello,
>
> I have the question that might seem trivial, but I didn't find a simple
> answer on it so far.
> Is there an easy (by easy I mean using built in functions) way to
> convert a decimal number to it hexadecimal representation. For example,
> FUNCT(10) would return 'A', and FUNC(16) would return '10'.
>
> P.S. After all I think that I spent more time investigating this issue
> then it would take to write the function myself
>
> Thanks,
>
> Igor
>
  Received on Fri Feb 14 1997 - 00:00:00 CET

Original text of this message