I'm not very familiar with BLOB and RAW Strings.
I am trying to convert BLOB to Base64 string and received ORA-06502: PL/SQL: numeric or value error: raw variable length too long error.
I am using the following function:
FUNCTION CONVERT_BLOB_TO_BASE64(
P_BLOB BLOB
)
RETURN CLOB
IS
V_CLOB CLOB := null;
V_CHUNK_SIZE PLS_INTEGER := 24000;
BEGIN
apex_debug.info ('*** In convert_to_base64');
FOR V_I IN 0..TRUNC((DBMS_LOB.GETLENGTH(P_BLOB) - 1 ) / V_CHUNK_SIZE) LOOP
apex_debug.info ('*** v_i = %s', to_char(v_i));
V_CLOB := V_CLOB || UTL_RAW.CAST_TO_VARCHAR2(
UTL_ENCODE.BASE64_ENCODE(
DBMS_LOB.SUBSTR(
P_BLOB,
V_CHUNK_SIZE,
V_I * V_CHUNK_SIZE + 1
)
)
);
apex_debug.info ('*** *** v_clob= %s',v_clob);
END LOOP;
RETURN V_CLOB;
END CONVERT_BLOB_TO_BASE64;
I am attaching the BLOB file (a PDF file)
Please help.
Sample Exh A document.pdf (60.44 KB)Thank you,
Robert