This chapter briefly introduces the UTL_COMPRESS package, and describes how to use the functions of the package.
This section describes the functions provided by the UTL_COMPRESS package, in alphabetical order.
Compresses a given data. Returns a type that matches the given type (BLOB or RAW).
Details about the LZ_COMPRESS function are as follows:
Prototypes
BLOB data
UTL_COMPRESS.LZ_COMPRESS ( src IN BLOB, quality IN BINARY_INTEGER DEFAULT 6 ) RETURN BLOB;
RAW data
UTL_COMPRESS.LZ_COMPRESS ( src IN RAW, quality IN BINARY_INTEGER DEFAULT 6 ) RETURN RAW;
Parameter
Parameter | Description |
---|---|
src | BLOB or RAW data to compress. |
quality | Compression ratio. Set to a value between 1 and 9. A larger value indicates higher compression ratio. (Default value: 6) |
Example
DECLARE data RAW(500); BEGIN data := UTL_COMPRESS.LZ_COMPRESS('A1B2C3D4E5F6', 6); DBMS_OUTPUT.PUT_LINE(data); END; /
Uncompresses a given data. Returns a type that matches the given type (BLOB or RAW).
Details about the LZ_UNCOMPRESS function are as follows:
Prototype
BLOB data
UTL_COMPRESS.LZ_UNCOMPRESS ( src IN BLOB ) RETURN BLOB;
RAW data
UTL_COMPRESS.LZ_UNCOMPRESS ( src IN RAW ) RETURN RAW;
Parameter
Parameter | Description |
---|---|
src | BLOB or RAW data to decompress. |
Example
DECLARE comp_data RAW(500); real_data RAW(500); BEGIN comp_data := UTL_COMPRESS.LZ_COMPRESS('A1B2C3D4E5F6', 6); real_data := UTL_COMPRESS.LZ_UNCOMPRESS(comp_data); DBMS_OUTPUT.PUT_LINE(real_data); END; /