OCTET_LENGTH
The OCTET_LENGTH function returns the length of a string expression in octets (bytes).
See LENGTH and CHARACTER_LENGTH or CHAR_LENGTH for similar functions.
- expression
- An expression that returns a value of any built-in numeric or string data type. A numeric argument is cast to a character string before evaluating the function. For more information about converting numeric to a character string, see VARCHAR.
The result of the function is DECIMAL(31). 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 the number of octets (bytes) in the argument. The length of a string includes trailing blanks. The length of a varying-length string is the actual length in octets (bytes), not the maximum length.
Example
- Assume table T1 has a GRAPHIC(10) column called C1.
Returns the value 20.SELECT OCTET_LENGTH( C1 ) FROM T1