FirebirdSQL logo

HEX_DECODE()

Decode a hexadecimal string to binary

Result type

VARBINARY or BLOB

Syntax
HEX_DECODE (hex_data)
Table 1. HEX_DECODE Function Parameter
Parameter Description

hex_data

Hex encoded data

HEX_DECODE decodes a string with hex-encoded data, and returns the decoded value as VARBINARY or BLOB as appropriate for the input.If the length of the type of hex_data is not a multiple of 2, an error is raised at prepare time.If the length of the value of hex_data is not a multiple of 2, an error is raised at execution time.

When the input is not BLOB, the length of the resulting type is calculated as type_length / 2, where type_length is the maximum length in characters of the input type.

Example of HEX_DECODE

select cast(hex_decode('48657861646563696D616C') as varchar(12))
from rdb$database;

CAST
============
Hexadecimal