ORA-6502/ORA-6512 Raised In SQL DML (Insert/Update) Populating BLOB Column Using UTL_RAW.CAST_TO_RAW()

(Doc ID 339823.1)

Last updated on AUGUST 29, 2017

Applies to:

PL/SQL - Version 8.0.4.0 and later
Information in this document applies to any platform.
***Checked for relevance on 24-Aug-2017***


Symptoms

Inserting or Updating a BLOB column of a table using UTL_RAW.CAST_TO_RAW()  from SQL like

update <table> set <BLOB-column> = utl_raw.cast_to_raw(<VARCHAR2-Column>);

or

insert into <table>(<BLOB-column> [,cols]) values (utl_raw.cast_to_raw(<VARCHAR2> [,vals]);

raises  

ORA-06502: PL/SQL: numeric or value error: raw variable length too long
ORA-06512: at "SYS.UTL_RAW", line 224

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms