I'm trying to fetch the BLOB field from sqlplus using below query but getting error
SQL Query ::
select
utl_raw.cast_to_varchar2(dbms_lob.substr(BLOB_FIELD,2000,1)) ,
utl_raw.cast_to_varchar2(dbms_lob.substr(BLOB_FIELD,4000,2000)) ,
utl_raw.cast_to_varchar2(dbms_lob.substr(BLOB_FIELD,6000,4000))
from BLOB_TABLE where id='342' ;
Error ::
ORA-06502: PL/SQL: numeric or value error: raw variable length too long
ORA-06512: at line 1
length of field is :: 4844
If I comment below line and run then its working fine.
utl_raw.cast_to_varchar2(dbms_lob.substr(BLOB_FIELD,4000,2000)) ,
Could you please let me know why the sql is failing for above line.
I need to spool the file from one DB and upload it into another DB.