Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: A bug on RAWTOHEX function
Hi Fumi,
compare to this:
set serveroutput on
declare
b raw (1):= 'AB'; a varchar2(8); begin a := rawtohex(b); dbms_output.put_line(a); select rawtohex(b) into a from dual; dbms_output.put_line(a);
It returns 'AB' and 'AB' just on Oracle8i on NT 4.0 SP 5.
The reason is in your constant 'AB' which is not a RAW but a VARCHAR2 and it is converted implicitly and differently.
Bottom line: Avoid implicit conversion.
Martin
fumi wrote:
>
> Hi, gurus,
> I found a bug on RAWTOHEX function.
> The return value are different when it is executed in PL/SQL and SQL.
> See the following example: (on Oracle8i, WinNT4 SP5)
>
> SQL> declare
> 2 a varchar2(8);
> 3 begin
> 4 a := rawtohex('AB');
> 5 dbms_output.put_line(a);
> 6 select rawtohex('AB') into a from dual;
> 7 dbms_output.put_line(a);
> 8 end;
> 9 /
> AB
> 4142
>
> PL/SQL procedure successfully completed.
Received on Sat Nov 27 1999 - 12:23:54 CST