What is the use of MySQL UNHEX() function?


As its name suggests, it is the opposite of HEX() function. Basically, UNHEX() function converts the hexadecimal number into the byte represented by the number. The value returned by it would be a binary string.

Syntax

UNHEX(str)

Here, str is a string which is to be converted into the byte represented by the number. The characters in the str must be a valid hexadecimal digit.

Example

mysql> Select UNHEX('5475746F7269616C73706F696E74');
+---------------------------------------+
| UNHEX('5475746F7269616C73706F696E74') |
+---------------------------------------+
| Tutorialspoint                        |
+---------------------------------------+
1 row in set (0.00 sec)

Monica Mona
Monica Mona

Student of life, and a lifelong learner

Updated on: 20-Jun-2020

407 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements