The OCTET_LENGTH (or LENGTHB) function calculates the length, in octets, of a value expression of any data type. If the result of the value expression is NULL, the function returns a null value. Otherwise, the function returns the length, in octets, of the value expression. You can use LENGTHB as an alternative for OCTET_LENGTH.