HEXTORAW scalar function
The HEXTORAW function returns a bit string representation of a hexadecimal character string.
The schema is SYSIBM.
In a Unicode database, if a supplied argument is a graphic string, it is converted to a character string before the function is executed.
-
character-expression
- An expression that returns a value that is a built-in character string that is not a CLOB (SQLSTATE 42815). The length must be an even number of characters from the ranges '0' to '9', 'a' to 'f', and 'A' to 'F' (SQLSTATE 42815).
The result of the function is a VARBINARY. The length attribute of the result is half the length attribute of character-expression and the actual length is half the length of the actual length of character-expression. If the first argument can be null, the result can be null; if the first argument is null, the result is the null value.
Example
Represent a string of hexadecimal
characters in binary form.
HEXTORAW('ef01abC9')The
result is a VARBINARY(4) data type with a value of BX'EF01ABC9'. 