The OCTET_LENGTH() function
Use the OCTET_LENGTH() SQL function to determine if the string is from a binaryvar or a binary18 column. The OCTET_LENGTH() function returns the number of octets (bytes).
Syntax
OCTET_LENGTH(column)
- column
- The binary data type column.
Usage
This function returns the length of
the column in bytes as an integer. For the binary18 data type, the
function always returns 18
.
For binary data types, the SQL LENGTH() and OCTET_LENGTH() functions return the same value. For more information about length functions, see the HCL OneDB™ Guide to SQL: Reference.
Example
SELECT octet_length(binaryvar_col) FROM table WHERE binaryvar_col = '93FB'
expression
------------------
2