What MySQL returns if I provide a non-hexadecimal number as an argument to UNHEX() function?

MySQLMySQLi Database

MySQL returns NULL if we provide any non-hexadecimal number as an argument to UNHEX() function. Following example will demonstrate it.

Example

mysql> Select UNHEX('ANK96598');
+-------------------+
| UNHEX('ANK96598') |
+-------------------+
| NULL              |
+-------------------+
1 row in set (0.00 sec)

As we know that the valid hexadecimal digits are between ‘0…9’, ‘A…F’ or ‘a…f’ hence the above query returns NULL.

raja
Published on 20-Feb-2018 13:20:30
Advertisements