雪花中的十六进制到十进制

Hexa to Decimal in snowflake

I need a query to convert hexa value to decimal value. below is the query

For 0xE7 the decimal value is 231.

How to convert hexadecimal value to decimal value in snowflake.
Below is the query I am trying to execute

select
hexa_decode_string(concat(substr('0x00E7000101000000'::varchar,1,2), substr(replace('0x00E7000101000000'::varchar,'0x'),3,2)));

您可能需要编写 JS UDF,下面是一个:

create or replace function hex_to_int (input string) 
returns double language JAVASCRIPT 
as 
'if (INPUT !== null)
{
op = parseInt(INPUT, 16);
}
return op';
      
select hex_to_int('0xE7');