LENGTH

Returns the length of a character string using as defined by the input character set.

The character string can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The return value is of data type NUMBER. If the character sting has data type CHAR, then the length includes all trailing blanks. If the character string is null, then this function returns 0 (zero).

Note:

The SQL function returns null if the character string is null.

Syntax

Restrictions

The SELECT command does not support the following functions: LENGTHB, LENGTHC, LENGTH2, and LENGTH4.

Example

This example shows the problem_id and the length of the problem_key for each problem.

select problem_id, length(problem_key) from problem;