LENGTH returns an INTEGER value representing the number of characters in a string. It strips the padding from CHAR expressions but not from VARCHAR expressions.
Syntax
LENGTH ( expression )
Semantics
expression |
(CHAR or VARCHAR) is the string to measure |
Notes
Examples
> SELECT LENGTH('1234 '::CHAR(10));
length
--------
4
(1 row)
> SELECT LENGTH('1234 '::VARCHAR(10));
length
--------
6
(1 row)
> SELECT LENGTH(NULL::CHAR(10)) IS NULL;
?column?
----------
t
(1 row)