title: Update a BLOB in Oracle
body: <p>Trying to update an existing pdf image in a blob with a new PDF image.</p>
  
  <p>Using the Script below</p>
  
  <pre><code>create or replace directory BLOBS as 'c:\scripts\blob\';
  
  DECLARE 
    v_lob    BLOB; 
    l_bfile  bfile; 
    amt      NUMBER; 
  
  BEGIN 
  
  l_bfile := bfilename('BLOBS', 'releaseofinformation.pdf' ); 
  
  SELECT td.TEMPLATE_IMAGE 
  INTO v_lob 
  FROM template_definition td 
  WHERE td.internal_name='AUTH_FOR_RELE_OF_INFO_FORM'
  FOR UPDATE; 
  
  amt := dbms_lob.getlength( l_bfile ); 
  
  dbms_lob.fileopen( l_bfile ,dbms_lob.file_readonly); 
  dbms_lob.OPEN(v_lob,dbms_lob.lob_readwrite);
  dbms_lob.loadfromfile( v_lob, l_bfile ,amt); 
  
  dbms_output.put_line('File length is: '||dbms_lob.getlength( l_bfile )); 
  dbms_output.put_line('Loaded length is: '||dbms_lob.getlength(v_lob)); 
  dbms_lob.close(v_lob);
  dbms_lob.fileclose( l_bfile ); 
  
  END; 
  /
  </code></pre>
  
  <p>The directory with the file is on the server for Oracle to use. 
  The script appears to run and reports the file length of the new file for both in the output.  When I query the record and select the blob in a popup editor, the blob appears unchanged. </p>
  
  <p>I tried then to update the procedure to update the blob with an empty_blob() and then run the script only to now have an empty blob. </p>
  
  <p>Thoughts and ideas?</p>
  
  <p>Thank you</p>