HEX()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a hexadecimal string representation of the argument.
USAGE
HEX(string | number)
Argument Name | Description |
---|---|
| The string or number to convert |
DETAILS
HEX()
is a string function that returns a hexadecimal string representation of the argument.When given a string argument, each byte is converted into a 2-digit hexadecimal representation and the concatenated string of hex digits is returned.
When given a numeric argument, the hexadecimal representation of the 64-bit number is returned as a string.
A
NULL
is returned if the argument isNULL
.
EXAMPLES
SELECT HEX(125), HEX('dbms'), CONV(HEX(125), 10, 10);
+----------+-------------+------------------------+
| HEX(125) | HEX('dbms') | CONV(HEX(125), 10, 10) |
+----------+-------------+------------------------+
| 7D | 64626D73 | 7 |
+----------+-------------+------------------------+