We generally use the
oracle sqlplus spooling feature to log the output of the sql commands. If the
output of the SQL command is too big in size, in such cases better to
zip/compress the spool file. Again the available free space in the file system
is too low to make the zip after creating the spool file is bit risky.
Sometimes there will not be room for hold the actual and zip file during the
compress process. In such situation you can use this method/script to compress
the file in parallel while spooling by using the unix pipe.