length()

Returns the number of characters in a string passed as parameter.

Syntax

length(
   str STRING )
  RETURNS INTEGER
  1. str is any valid character string expression supported by the language.

Usage

The length() function counts the length of a character string.

If the parameter is NULL, the function returns zero.

Important: When using byte length semantics, the length is expressed in bytes. When using char length semantics, the unit is characters. This matters when using a multibyte locale such as UTF-8.