Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> base64 encoding

base64 encoding

From: Jeroen van Sluisdam <jeroen.van.sluisdam_at_vrijuit.nl>
Date: 23 Nov 2004 07:44:36 -0800
Message-ID: <cb391de7.0411230744.4ec04821@posting.google.com>


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;

BEGIN
  dbms_output.put_line('length blob: ' || dbms_lob.getlength( lv_blob ) );
  begin
      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;

  end;
-- dbms_output.put_line('length:'||dbms_lob.getlength(result));   RETURN ( result );
END getbase64String; Received on Tue Nov 23 2004 - 09:44:36 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US