LENGTH Function

The LENGTH function (also called LEN) returns the number of bytes in a character column, but excluding any trailing blank spaces.

For BYTE or TEXT columns, LENGTH returns the full number of bytes, including any trailing blank spaces.

In , LENGTH can also return the length of a character variable.

The following example illustrates the use of the LENGTH function:
SELECT customer_num, LENGTH(fname) + LENGTH(lname),
   LENGTH('How many bytes is this?')
   FROM customer WHERE LENGTH(company) > 10; 
The next example calls the function by its other name, LEN;
EXECUTE FUNCTION LEN("www.hcl.com");
The SQL statement above returns the integer value 11.

See also the discussion of LENGTH in the HCL OneDB™ GLS User's Guide.