HEX
Description
The HEX function is used to convert different types of data into a hexadecimal format string. This function accepts various input types, including strings, binary numbers, and big integers, and converts them into the corresponding hexadecimal representation.
Parameter Description
- expr: string/binary/bigint
- The input data to be converted.
Return Result
Returns a string representing the hexadecimal form of the input data.
Usage Example
- Convert a string to hexadecimal:
Result:
- Convert Binary to Hexadecimal:
Result:
- Convert large integers to hexadecimal:
Result:
Notes
- For empty string input, the HEX function will return an empty string.
- When the input data cannot be converted to hexadecimal, the function will return NULL.