CHAR_LENGTH()

Documentation

Home » Documentation » Using VoltDB

CHAR_LENGTH()

CHAR_LENGTH() — Returns the number of characters in a string.

Synopsis

CHAR_LENGTH( string-expression )

Description

The CHAR_LENGTH() function returns the number of text characters in a string.

Note that the number of characters and the amount of physical space required to store those characters can differ. To measure the length of the string, in bytes, use the OCTET_LENGTH() function.

Example

The following example returns the string in the column LastName as well as the number of characters and length in bytes of that string.

SELECT LastName, CHAR_LENGTH(LastName), OCTET_LENGTH(LastName)
    FROM Customers ORDER BY LastName, FirstName;