HEX_DECODE()
All functions > STRING > HEX_DECODE()
Decodes a contiguous hexadecimal string back to plain text.
Signatures
Returns: Decoded string
HEX_DECODE(hex_digits: VARCHAR) → VARCHAR sql
| Parameter | Type | Required | Description |
|---|---|---|---|
hex_digits | VARCHAR | Yes | Hex string (even length; mixed case allowed) |
Notes
- Requires an even number of hex digits; malformed input fails at run time
- Interprets decoded bytes as text (invalid byte sequences fail at run time)
- Returns NULL if the input is NULL (use
NULL(VARCHAR); bareNULLfails inference) - Inverse of
HEX_ENCODEfor valid round-trip payloads
See also
Examples
FeatureQL
SELECT
f1 := HEX_DECODE('68656c6c6f'), -- Lowercase hex digits
f2 := HEX_DECODE(''), -- Empty hex decodes to empty string
f3 := HEX_DECODE(NULL(VARCHAR)) -- NULL yields NULL
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR |
|---|---|---|
| hello | (empty) | NULL |
On this page