HEX_ENCODE()
All functions > STRING > HEX_ENCODE()
Encodes a string as a contiguous hexadecimal string (two hex digits per byte).
Signatures
Returns: Hex digits only (length is even for non-NULL input)
HEX_ENCODE(string: VARCHAR) → VARCHAR sql
| Parameter | Type | Required | Description |
|---|---|---|---|
string | VARCHAR | Yes | Input text to encode |
Notes
- Each input byte becomes two hexadecimal characters (uppercase
A–F) - Returns NULL if the input is NULL (use
NULL(VARCHAR); bareNULLfails inference) - Pair with
HEX_DECODEto recover the original string when the hex is valid
See also
Examples
FeatureQL
SELECT
f1 := HEX_ENCODE('hello'), -- UTF-8 bytes of ASCII text
f2 := HEX_ENCODE(''), -- Empty string
f3 := HEX_ENCODE(NULL(VARCHAR)) -- NULL yields NULL
;Result
| f1 VARCHAR | f2 VARCHAR | f3 VARCHAR |
|---|---|---|
| 68656C6C6F | (empty) | NULL |
On this page