title: How to use UTL_COMPRESS package to compress the txt file and create gz file in unix with oracle 11 g?
body: <p>I have following requirement :
  Actually I have txt file I need to compress this file and create gz file using oracle UTL_COMPRESS package.
  I need to implement this functionality on Unix box with Oracle 11g.
  I have tried it with below code and it is working for some extent.I mean it is working to compress the small size file. </p>
  
  <pre><code>DECLARE
     f utl_file.file_type;
     compressed     BLOB;
    data_b BFILE;
  BEGIN
     f := UTL_FILE.fopen ('DIR_UTL_COM_TEST', 'Test1.gz', 'wb');
     data_b := BFILENAME ('DIR_UTL_COM_TEST','pk_intibuy_pkb.txt');
     DBMS_LOB.FILEOPEN (data_b, DBMS_LOB.LOB_READONLY);
     DBMS_LOB.createtemporary (compressed, false);
     compressed := UTL_COMPRESS.lz_compress (data_b,6);
     UTL_FILE.put_raw(f, compressed, true);
     UTL_FILE.fclose (f);
     DBMS_LOB.FILECLOSE (data_b);
     DBMS_LOB.freetemporary (compressed);
  END;
  </code></pre>
  
  <p>But this code is not working to compress the large file.
  Please help if some implement this functionality in oracle 11g.
  Would be much appreciate. 
  Error Messages:</p>
  
  <pre><code>Error report:
  ORA-06502: PL/SQL: numeric or value error 
  ORA-06512: at line 11 06502. 00000 - "PL/SQL: numeric or value error%s"
  </code></pre>