Returns the string length of the value of the given character expression.

Syntax

LENGTH ( char_expression )

Notes

  • The argument to the function must be of type CHARACTER or VARCHAR.
  • The result is of type INTEGER.
  • If the argument expression evaluates to NULL, the result is NULL.
  • char_expression can contain multi‑byte characters. The function returns a number of characters.

Example

This example illustrates the LENGTH function:

SELECT last_name 'LONG LAST_NAME'
     FROM customer 
     WHERE LENGTH (last_name) > 5 ;

Compatibility

ODBC compatible