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;