Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> base64 encoding
Hi,
We have to provide a conversion of blobs to base64 in order to
exchange data with
a 3th party. I wrote the following function which is used to format an
xml-message.
Problem is the supplier reads this data with a .net decode of base64
complains it's invalid and it
sees some lines with more than 76 characters which seems to be not
correct.
Any ideas what is wrong are greatly appreciated.
9.2.0.4 HPUX11.11
Tnx,
Jeroen
Function getbase64String( lv_blob blob )
Return clob is
Result clob;
resultString VARCHAR2(4096);
resultString1 clob;
l_amt number default 2048; l_raw raw(4096); l_offset number default 1; l_clob clob;
DBMS_LOB.CREATETEMPORARY(resultString1,FALSE,DBMS_LOB.CALL); DBMS_LOB.CREATETEMPORARY(result,FALSE,DBMS_LOB.CALL); loop dbms_lob.read( lv_blob, l_amt, l_offset, l_raw ); l_offset := l_offset + l_amt; -- dbms_output.put_line(' voor resultstring'); resultString := utl_raw.cast_to_varchar2( utl_encode.base64_encode( l_raw ) ); -- dbms_output.put_line(' na resultsstring'); resultString1:=to_clob(resultString); dbms_lob.append(result,resultString1); end loop; exception when no_data_found then null;