当前位置:数据库 > SQLServer >>

PostgreSQL从十六进制转换为十进制

PostgreSQL从十六进制转换为十进制
 
-- Function: hex_to_dec(text) 

-- DROP FUNCTION hex_to_dec(text); 

CREATE OR REPLACE FUNCTION hex_to_dec(in_hex text) 
  RETURNS integer AS 
$BODY$ 
  SELECT CAST(CAST(('x' || CAST($1 AS text)) AS bit(8)) AS INT); 
$BODY$ 
  LANGUAGE sql IMMUTABLE STRICT 
  COST 100; 
ALTER FUNCTION hex_to_dec(text) 
  OWNER TO postgres; 

 


CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,