Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HexToRaw/RawToHex SQL and PL/SQL difference...

BluShadowApr 3 2007 — edited Apr 4 2007
Anybody any idea why I can't assign my string to a raw datatype using a PL/SQL assignment, when it's happy to do it as through SQL?

Haven't had to do much with RAW's before, but now I have a requirement in order to push some RAW data over a TCP connection.
SQL> declare
  2    v_t RAW(32767);
  3  begin
  4    DBMS_OUTPUT.PUT_LINE('Select Statement Starting...');
  5    select HEXTORAW(RAWTOHEX('BLUSHADOW')) into v_t from dual;
  6    DBMS_OUTPUT.PUT_LINE('Completed OK');
  7    DBMS_OUTPUT.PUT_LINE('PL/SQL Assignment Starting...');
  8    v_t := HEXTORAW(RAWTOHEX('BLUSHADOW'));
  9    DBMS_OUTPUT.PUT_LINE('Completed OK');
 10  EXCEPTION
 11    WHEN OTHERS THEN
 12      DBMS_OUTPUT.PUT_LINE('Failed');
 13  end;
 14  /
Select Statement Starting...
Completed OK
PL/SQL Assignment Starting...
Failed

PL/SQL procedure successfully completed.

SQL>
Edit: And for those wanting to know what the error is...
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
ORA-06512: at line 8
Message was edited by:
blushadow
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2007
Added on Apr 3 2007
5 comments
2,898 views