How to convert hex type data to char or integer type data (DBMR2801)

~ 0 min
2017-01-11 08:13

You can use CAST to convert hex to char, and use BINTOINT to convert hex to integer type. Function BINTOINT supported in new versions built after 2016/02/23.

Usage examples:

dmSQL> select cast('6162'x as char(2));

CAST('6162'X AS CHAR(2))

========================

ab                      

dmSQL> select cast('ab' as binary(2));

CAST('AB' AS BINARY(2))

=======================

6162                   

 

dmSQL>CREATE FUNCTION strtoint.BINTOINT(BINARY(8)) RETURNS BIGINT;

dmSQL>select bintoint('07DF'x);

 BINTOINT('07DF'X)  

====================

                2015

Version: 5.3.3, 5.4.1

Product: Normal/Bundle

Platform: Windows/Linux

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags