SQLite UNHEX() Function
Example
Turn a hexadecimal text into a blob, and show it as text:
SELECT CAST(UNHEX('48656C6C6F') AS TEXT);
Try it Yourself »
Definition and Usage
The UNHEX() function turns a hexadecimal text into a blob with those bytes. It is the opposite of HEX().
It returns NULL if the text is not a valid hexadecimal text.
Tip: Also look at HEX().
Syntax
UNHEX(hex_text, ignore)
Parameter Values
| Parameter | Description |
|---|---|
| hex_text | Required. The hexadecimal text |
| ignore | Optional. Characters in the text that should be skipped, like spaces |
Technical Details
| Return type: | Blob |
|---|---|
| Works in: | SQLite 3.41.0 and later |