Function group: numeric function
OCTET_LENGTH() determines the number of bytes in a string.
OCTET_LENGTH (
expression )
expression
Alphanumeric expression or national expression. Its evaluation must return either an alphanumeric string (data type CHAR or VARCHAR) or a national string (data type NCHAR or NVARCHAR). expression may not be a multiple value with dimension > 1. See also section "Compatibility between data types".
Result
If the string contains the NULL value, the result is the NULL value.
Otherwise:
The result is the number of bytes in the string.
Data type: INTEGER
Examples
Determine the number of bytes in the alphanumeric string 'only' (result: 4).
OCTET_LENGTH ('only')
Determine the number of bytes in the national string 'An evening in old München' (result: 16).
OCTET_LENGTH (U&'An evening in old M\00FCnchen')