All Forums Database
Abhishek_RC 12 posts Joined 09/14
02 Apr 2015
Hex to Char conversion

is there a way to convert hex to char in teradata ?
I understand this is a way but it onyl works when values are hardcoded, not when the source is a column value. 


           '312c30313637'  AS hex_value

         ,  _LATIN'312c30313637'XC AS char_value


dnoeth 4628 posts Joined 11/04
02 Apr 2015

Hi Abhishek,
what's your Teradata release?
Since TD14 there are two new functions for Hex/Byte conversions.
If the characters in the Hex-string are ASCII you can use this:

FROM_BYTES(TO_BYTES(hex_value, 'base16'), 'ascii')

Or you could install some UDFs from the Unicode Tool Kit:

udf_LatinHex2Char(hex_value,'','') -- for Latin
udf_16BEHex2Char(hex_value, '','') -- for UTF16 Unicode



You must sign in to leave a comment.