The schema is SYSIBM.
The OCTET_LENGTH function returns the length of expression in octets (bytes).
The result of the function is INTEGER. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
The length of character or graphic strings includes trailing blanks. The length of binary strings includes binary zeroes. The length of varying-length strings is the actual length and not the maximum length.
For greater portability, code your application to be able to accept a result of data type DECIMAL(31).
Examples:
SELECT OCTET_LENGTH(C1) FROM T1
returns
the value 20.'&' | 'N' | '~' | 'A' | 'B' | |
---|---|---|---|---|---|
UTF-8 | X'F09D849E' | X'4E' | X'CC83' | X'41' | X'42' |
UTF-16BE | X'D834DD1E' | X'004E' | X'0303' | X'0041' | X'0042' |
SELECT OCTET_LENGTH(UTF8_VAR),
OCTET_LENGTH(UTF16_VAR)
FROM SYSIBM.SYSDUMMY1
returns the values 9 and
12, respectively.