I have the following requirement: Actually, I have a txt file, I need to compress this file and create a gz file using the oracle UTL_COMPRESS package. I need to implement this functionality in a Unix block with Oracle 11g. I tried it with the code below and it works to some extent. I mean, it works to compress a small file.
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;
But this code does not work to compress a large file. Please help if some implement this functionality in oracle 11g. It would be very grateful. Error messages:
Error report: ORA-06502: PL/SQL: numeric or value error ORA-06512: at line 11 06502. 00000 - "PL/SQL: numeric or value error%s"
source share