unhex

description

Syntax

VARCHAR unhex(VARCHAR str)

Enter a string, if the length of the string is 0 or an odd number, an empty string is returned; If the string contains characters other than [0-9], [a-f], [A-F], an empty string is returned; In other cases, every two characters are a group of characters converted into hexadecimal, and then spliced into a string for output.

example

  1. mysql> select unhex('@');
  2. +------------+
  3. | unhex('@') |
  4. +------------+
  5. | |
  6. +------------+
  7. mysql> select unhex('41');
  8. +-------------+
  9. | unhex('41') |
  10. +-------------+
  11. | A |
  12. +-------------+
  13. mysql> select unhex('4142');
  14. +---------------+
  15. | unhex('4142') |
  16. +---------------+
  17. | AB |
  18. +---------------+

keywords

  1. UNHEX