Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

HEX String to INTEGER conversion

$
0
0

Hi,

 

I would like to convert a hex string representation to the corresponding INTEGER value.

 

I've tried:

 

select cast(hextobin('A') as int) from dummy;

which yields:

 

Could not execute 'select cast(hextobin('A') as int) from dummy' in 34 ms 902 µs .

SAP DBTech JDBC: [339]: invalid number: '0A' at function to_int()

 

I know that the next statement works, but 0xA is already binary and I guess implicite typeconversion just parses the token to integer without typecasting.

 

select cast(0xA as int) from dummy;

Any ideas?

 

Many thanks in advance,

Bodo

 

PS: The background is that I'm searching a way to hash a string value with hash_sha256 to number format (like ORA_HASH in oracle db). I've not found a way to typecast varbinary to number. Instead I try to convert to hex representation first and then convert to integer.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>