title: PL/SQL TEXT_IO package
body: <p>I am trying to write to a local file from a PL/SQL script. In order to do this, I am attempting to use the TEXT_IO package in PL/SQL.</p>
  
  <pre><code>DECLARE
  file_out text_io.file_type;
  len number;
  blob_file blob;
  my_var RAW(50);
  bstart NUMBER := 1;
  bytelen NUMBER := 50;
  
  BEGIN
  
  SELECT xxx
  INTO blob_file
  FROM yyy
  WHERE zzz
  
  dbms_lob.read(blob_file, bytelen, bstart, my_var);    
  file_out := text_io.fopen('local_file_path', 'w');
  text_io.put_raw(file_out, my_var);
  text_io.fflush(file_out);
  text_io.fclose(file_out);
  
  END;
  /
  
  quit
  </code></pre>
  
  <p>However, when I run this script I get the error, </p>
  
  <pre><code>PLS-00201: identifier 'TEXT_IO.FILE_TYPE' must be declared
  </code></pre>
  
  <p>Does anyone know how I can fix this error, and how I can write the contents of the blob to a file as I am attempting to do?</p>
  
  <p>Thanks,<br>
  ktm</p>