In the following query, the LENGTH function
calculates the number of bytes in the combined fname and lname columns
for each row where the length of company is greater than 15.Figure 1: Query
SELECT customer_num,
LENGTH (fname) + LENGTH (lname) namelength
FROM customer
WHERE LENGTH (company) > 15;
Although the LENGTH function might
not be useful when you work with DB-Access,
it can be important to determine the string length for programs and
reports. The LENGTH function returns the clipped
length of a CHARACTER or VARCHAR string and the full number of bytes
in a TEXT or BYTE string.
HCL OneDB™ also
supports the CHAR_LENGTH function, which returns
the number of logical characters in its string argument, rather than
the number of bytes. This function is useful in locales where a single
logical character might require more than a single byte of storage.
For more information about the CHAR_LENGTH function,
see the HCL OneDB Guide to SQL:
Syntax and
the HCL OneDB GLS
User's Guide.