The VARBINARY function returns a varying-length binary string that consists of the binary string expression having length, as specified by the function's second argument. The first argument data type is either binary or varbinary. The second argument is a numerical integer constant having a value in the range of 1 through 32704.
If the first argument is nullable, the result will be nullable and if the first argument is null, the result will be the null value.
The following guidelines apply to the second argument:
The specified length is treated as the maximum length.
The actual length of the result will be the minimum of the string expression and the specified length.
If the length is shorter than the source, the string will be truncated without warning.
UNLOAD SELECT VARBINARY(BX’123456’,2) FROM SYSIBM.SYSDUMMY1
This results in the varying binary string of X’00021234’.
UNLOAD SELECT VARBINARY(BX’123456’,5) FROM SYSIBM.SYSDUMMY1
This results in the varying binary string of: X’0003123456’
Important
For IBM Db2, BINARY and VARBINARY functions accept other types of string expressions such as CHAR and Graphic. BMC AMI Utilities functions are restricted to binary string expressions.
13.1
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*