All Forums General
Purushotham 87 posts Joined 04/14
08 Nov 2014
what is the use of sel CHAR2HEXINT(COL2) FROM TABLENAME?COULD ANYONE PLS EXPLAIN ME.

I create a table with columns as:
create table puru_n(id int,name char(10),salary int);
if i insert data into table(10,'abc   ',20000);
there is a space in the second field; then i fire a sel CHAR2HEXINT(NAME) FROM TABLE 
i am getting a result as 414243020202020202. what is this result?
could anyone plsease explain me.......
 
Regards,
purushotham
 

Purushotham.M
dnoeth 4628 posts Joined 11/04
09 Nov 2014

Hi Purushotham,
CHAR2HEXINT returns the hexadecimal representation of the input string.
Your column name is a CHAR(10), so it's padded with blanks to the defined size:
41='A', 42='B', 43='C', 20=' ' in the LATIN character set, I assume you didn't paste the actual result, which should be '61626320202020202020' while 'abc   ' results in '41424320202020202020'
 
 

Dieter

You must sign in to leave a comment.