DECOMPRESS_STRING
functionsupportedCore SQL functionsDecompresses the compressed BINARY input parameter to a string.
Syntax
DECOMPRESS_STRING(<input>, <method>)
Parameters
| Name | Required | Description |
|---|---|---|
input | required | A BINARY value (or expression) with data that was compressed using one of the compression methods specified in COMPRESS. |
method | required | The compression method originally used to compress the input. See COMPRESS for a list of compression methods. The DECOMPRESS_STRING method, unlike the COMPRESS method, does not require you to specify the compression level. If you do specify the compression level, DECOMPRESS_STRING ignores it and uses the actual compression level. |
Returns
A string with decompressed data.
Usage notes
- If the compression method is unknown or invalid, the query fails.
- The compression method name (e.g. ZLIB) is case insensitive.
- If you use DECOMPRESS_STRING to decompress a compressed BINARY value, rather than a compressed string value, you do not necessarily get an error; instead, the function attempts to treat the BINARY value as a sequence of hexadecimal digits and then attempts to convert those hexadecimal digits into printable characters. Snowflake recommends that you use the DECOMPRESS_BINARY function to decompress compressed data if the original data was BINARY.