String & binary functions (Encoding/Decoding)
Encodes the input using hexadecimal (also ‘hex’ or ‘base16’) encoding. The result is comprised of 16 different symbols: The numbers ‘0’ to ‘9’ as well as the letters ‘A’ to ‘F’ (or ‘a’ to ‘f’, see below).
HEX_ENCODE(<input> [, <case>])
Copy
Arguments¶Required:
input
A binary or string expression to be encoded.
Optional:
case
This optional boolean argument controls the case of the letters (‘A’, ‘B’, ‘C’, ‘D’, ‘E’ and ‘F’) used in the encoding. The default value is 1
and indicates that uppercase letters are used. The value 0
indicates that lowercase letters are used. All other values are illegal and result in an error.
This returns a string that contains only hexadecimal digits.
Examples¶Encode a string:
SELECT HEX_ENCODE('Snowflake'); -------------------------+ HEX_ENCODE('SNOWFLAKE') | -------------------------+ 536E6F77666C616B65 | -------------------------+
Copy
Encode a string using lowercase letters:
SELECT HEX_ENCODE('Snowflake',0); ---------------------------+ HEX_ENCODE('SNOWFLAKE',0) | ---------------------------+ 536e6f77666c616b65 | ---------------------------+
Copy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4