cancel
Showing results for 
Search instead for 
Did you mean: 

CALC VIEW: hextoraw('41 42') results in error: "Error: SAP DBTech JDBC: [264]:"

roland_bouman
Contributor
0 Kudos

Hi all,

I'm on HANA 1.00.122.12.1502962396 (fa/hana1sp12) andI have a calculation view consisting of a projection on SYS.DUMMY with a calculated column with this (column engine) expression:

hextoraw('4142')

When I query the calculation view, this is fine. When I add another calculation column with this expression:

hextoraw('41 42')

(So, same two bytes, but with a space inbetween), I get this error when I query the view:

"Error: SAP DBTech JDBC: [264]: invalid datatype: the value has an invalid hexadecimal format at function hextobin() at function hextobin()"

I'd like to understand what the problem is.
In the documentation for hextoraw (https://help.sap.com/viewer/fc5ace7a367c434190a8047881f92ed8/2.0.03/en-US/f5a9ca3718354a499a98ba61ae...) , it reads:

"Convert a hexadecimal representation of bytes to a string of bytes. The hexadecimal string may contain 0-9, upper or lowercase a-f and no spaces between the two digits of a byte; spaces between bytes are allowed."

I'd think that in '41 42' the space is indeed between two bytes (41 and 42), so what's the matter?

thanks in advance and best regards,

Roland.

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor

Looking at what I believe is the correct piece of code in the SAP HANA kernel I'm pretty confident that this is an error in the documentation.

For a 100% statement on this matter the support incident would be the way to go.

roland_bouman
Contributor
0 Kudos

Lars, thanks!

I ran into this for a bit of a pet project, so I can't really justify setting up a support incident. So, if I understand correctly, the doc should have read that no spaces are allowed in the hexstring? (that would make more sense to me too)

Answers (1)

Answers (1)

0 Kudos

You can use '20' for space in hexadecimal which will convert into a space in string. So you can use the formula as hextoraw('412042') which will result 'A B'.

roland_bouman
Contributor
0 Kudos

Hi @Avijit Dutta,

thanks!

So I take it lars.breddemann answer still holds then, as in: the documentation is off?

I mean, a space is a space (' '). 20 maybe the hexadecimal representation of a space, but that's not actually a space.

If the argument to hextoraw is truly a string composed of bytes denoted in hexadecimal digits, then I don't see how it is ever possible to have "spaces between the two digits of a byte".

I mean, 9209 could never be parsed as 9 + 20 + 9 since it would be out of frame - it would always be read pairwise as 92 + 09. Right?

0 Kudos

Hi,

When we are converting hexadecimal bytes to string character; we got 20 as the smallest hexadecimal byte which can be converted to a string character that is a space.

So 09 can not be a correct hexadecimal byte which can be converted to string character. So a hexadecimal byte must be between 21 to FF as a argument of hextoraw.

Hope I could able to explain 🙂