SQLite hex() Function
The SQLite hex() function treats the parameter as a BLOB and returns a string representing the hexadecimal uppercase form of this BLOB.
Syntax
Here is the syntax of the SQLite hex() function:
hex(x)
Parameters
x-
Required. It can be anything you want to represent it in hexadecimal form.
Return value
The SQLite hex() function returns a string that is an uppercase hexadecimal representation of the contents of the BLOB specified by the parameter.
Examples
To return the hexadecimal representation of abc, use the following statement:
SELECT hex('abc');
hex('abc')
----------
616263To return the hexadecimal representation of I love the world., use the following statement:
SELECT hex('I love the world.');
hex('I love the world.')
----------------------------------
49206C6F76652074686520776F726C642EIf you need to restore the hexadecimal string to the source string, use the following cast() function:
SELECT cast(x'49206C6F76652074686520776F726C642E' as varchar);
cast(x'49206C6F76652074686520776F726C642E' as varchar)
------------------------------------------------------
I love the world.