SQLite Forum

HEX - What is the reverse function?
Login
Thanks; your expression works.

However, setting output option for clarity, thus: 

.mode column
.headers on

However,

sqlite> /* First attempt with prefix x */
sqlite> SELECT cast('x' || hex('Price is 3€') AS TEXT) AS originalValue;
originalValue
-----------------------
x507269636520697320333F
sqlite> /* Second attempt without prefix x*/
sqlite> WITH cte (hexvalue)
   ...> AS (
   ...> SELECT hex('Price is 3€')
   ...> )
   ...> SELECT cast(hexvalue AS TEXT)
   ...> FROM cte;
cast(hexvalue AS TEXT)
----------------------
507269636520697320333F
sqlite> /* Third attempt .. from a table */
sqlite> create temp table tmp as select hex('Price is 3€') as hexValue;
sqlite> select cast(hexValue as text) from tmp;
cast(hexValue as text)
----------------------
507269636520697320333F
sqlite>

I cannot see why neither of the three ways I tried returns the original value. Any ideas?