SQL hex_to_blob function to cast hexadecimal text to a BLOB

The hex_to_blob SQL-function was added to Invantive SQL. Hex_to_blob accepts a text with the hexadecimal representation of a BLOB and casts it to a BLOB.

The hexadecimal representation must consist of two characters per byte.

Hex_to_blob is the reverse of the to_hex function, which accepts a BLOB and returns a hex string. The following SQL-expression will always return the original value:

select hex_to_blob(to_hex(column name))
from   table

The maximum supported size of the BLOB data type remains 2 GB, but this limitation also applies to text in Unicode-representation. The hex_to_blob function interprets each character as four bits output, so the largest BLOB that is supported as output to hex_to_blob is 500 MB.

Availability

The SQL-function hex_to_blob is available starting release 22.0.630 and BETA release 22.1.190.