title: split blob file
body: <p>I need to retrieve from the database a few large wave files and would like to retrieve divided into wave files smaller (about 5Mb). How can I do? I've seen the procedure dbms_lob.read, but this return maximum file size of 32Kb.</p>
  
  <p>Regards</p>
  
  <pre><code>procedure extract_blob(p_id in number, wrote_length in out number, chunk out blob) is
     len_file binary_integer;
     myblob blob;
     myname varchar2(255);
     buffer_length number := 32760;
  
     begin    
       select file_wav_data, file_wav_name, dbms_lob.getlength(file_wav_data)
       into myblob, myname, lun_file 
       from t_wav 
       where id = p_id;
  
       if(len_file &gt; wrote_length) then
           dbms_lob.read(myblob,buffer_length,wrote_length+1,chunk);
           wrote_length := wrote_length + buffer_length;
       else wrote_length := -999; --EOF
       end if;
     end;
  </code></pre>