string-expression
The string to be compressed. Binary values can be passed to this function. This parameter is case sensitive, even in
case-insensitive databases.
compression-algorithm-alias
Alias for the algorithm to use for compression. The supported values are zip and gzip (both are based on the same algorithm,
but use different headers and trailers).
Zip is a widely supported compression algorithm. Gzip is compatible with the gzip utility on Unix, whereas the zip algorithm
is not.
Decompression must be performed with the same algorithm.
The value returned by the COMPRESS is not human-readable. If the value returned is longer than the original string, its maximum
size will not be larger than a 0.1% increase over the original string + 12 bytes. You can decompress a compressed string-expression using the DECOMPRESS function.
If you are storing compressed values in a table, the column should be BINARY or LONG BINARY so that character set conversion
is not performed on the data.
The following example returns the length of the binary string created by compressing the string 'Hello World' using the gzip
algorithm. This example can be useful when you want to determine whether a value has a shorter length when compressed.