The LENGTH function returns the length of a value. See CHARACTER_LENGTH, OCTET_LENGTH, and BIT_LENGTH for similar functions.
The result of the function is a large integer. 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 length of the argument. The length of strings includes blanks. The length of a varying-length string is the actual length, not the length attribute.
The length of a graphic string is the number of double-byte characters (the number of bytes divided by 2). The length of all other values is the number of bytes used to represent the value:
SELECT LENGTH(:ADDRESS) FROM SYSIBM.SYSDUMMY1Returns the value 18.
SELECT LENGTH(PRSTDATE) FROM PROJECTReturns the value 4.
SELECT LENGTH(CHAR(PRSTDATE, EUR)) FROM PROJECTReturns the value 10.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.