Compress Text File Using PL/Sql
Hi All,
My Environment is -------> Oracle 11g Database Release 1 On Windows 2003 Server SP2
Requirement is ------------> Compress a text file using Oracle pl/sql
I am tryring to compress a text file using below pl/sql code,
DECLARE
src_file BFILE;
v_content BLOB;
v_blob_len INTEGER;
v_file UTL_FILE.file_type;
v_buffer RAW(32767);
v_amount BINARY_INTEGER := 32767;
v_pos INTEGER := 1;
v_blob BLOB;
BEGIN
src_file := BFILENAME('MY_FILES','expLive.log');
DBMS_LOB.fileopen(src_file, dbms_lob.file_readonly);
v_content := utl_compress.lz_compress(src_file);
v_blob_len := DBMS_LOB.getlength(v_content);
v_file := UTL_FILE.fopen('MY_FILES','test.log.zip','wb');
WHILE v_pos < v_blob_len
LOOP
DBMS_LOB.READ(v_content, v_amount, v_pos, v_buffer);
UTL_FILE.put_raw(v_file, v_buffer, TRUE);
v_pos := v_pos + v_amount;
END LOOP;
UTL_FILE.fclose(v_file);
EXCEPTION
WHEN OTHERS THEN
IF UTL_FILE.is_open(v_file) THEN
UTL_FILE.fclose(v_file);
END IF;
RAISE;
END;
i am able to get the zip file without any problem.But the Problem here is size of the zip file, Acutal Text File Size is 520 KB and zip file size is 241KB. is there any possible way to compress little bit further to 100KB?
Please Advice ....in case if you are have an example please share it.
Thanks for your helps
Shan