This topic contains additional information for query for iSeries™.
A binary constant is used for comparing a literal with a binary field (BINARY, VARBINARY, or BLOB). Binary constants are represented with an X followed by a sequence of characters that starts and ends with a string delimiter. The characters between the string delimiters must be an even number of hexadecimal digits. A hexadecimal digit is a digit or any of the letters A through F (uppercase and lowercase), as shown in the following example:
Field Test Value binarycol eq X'12AF'
>>-BINARY--(--string-expression--+-----------+--)-------------->< '-, integer-'
The result of the function is a fixed-length binary string. If the first argument can be null, the result can be null; if the first argument is null, the result is the null value.
The first argument must be a string-expression whose value must be a built-in character string, graphic string, binary string, or row ID data type.
The actual length is the same as the length attribute of the result. If the length of the string-expression is less than the length of the result, the result is padded with hexadecimal zeros up to the length of the result. If the length of the string-expression is greater than the length attribute of the result, truncation is performed.
>>-VARBINARY--(--string-expression--+-----------+--)----------->< '-, integer-'
The result of the function is VARBINARY. If the first argument can be null, the result can be null; if the first argument is null, the result is the null value.
The first argument is a string-expression whose value can be a character string, graphic string, binary string, or row ID.
The actual length is the same as the length attribute of the result. If the length of the string-expression is less than the length of the result, the result is padded with hexadecimal zeros up to the length of the result. If the length of the string-expression is greater than the length attribute of the result, truncation is performed.
>>-HEX--(--expression--)---------------------------------------><
The argument can be of any built-in data type. The result of the function is a character string. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
The result is a string of hexadecimal digits. The first two digits represent the first byte of the argument, the next two digits represent the second byte of the argument, and so forth. If the argument is a datetime value, the result is the hexadecimal representation of the internal form of the argument.
The length attribute of the result is twice the storage length attribute of the argument. The length attribute of the result cannot be greater than 32766 for fixed-length results or greater than 32740 for varying-length results. If the argument is a varying-length string, the result is a varying-length string. Otherwise, the result is a fixed-length string.
The CCSID of the string is the default SBCS CCSID at the current server.
>>-LENGTH--(--expression--)------------------------------------><
The argument must be an expression that returns a value of any built-in data type. The result of the function is a large integer. If the argument can be null, the result can be null; if the argument is null, the result is the null value.