All Products
Search
Document Center

LENGTH

Last Updated: Jun 18, 2021

The LENGTH function returns the length of a string.

Notice

A multibyte character, such as a Chinese character and a full-width character, is calculated as one character.

Syntax

LENGTH(c1)

Parameters

Parameter

Description

c1

The string of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type.

Return type

NUMBER data type

Examples

This example shows the lengths of the strings: Test, Haidian District of Beijing, and Beijing TO_CHAR.

SELECT LENGTH ('Test'), LENGTH('Haidian District of Beijing'), LENGTH('Beijing TO_CHAR') FROM DUAL;

The following result is returned:

+------------------+------------------------------+-------------------------+
|    LENGTH('Test')|         LENGTH('Haidian District of Beijing') |   LENGTH('Bejing TO_CHAR') |
+------------------+------------------------------+-------------------------+
|                2 |                            6 |                       9 |
+------------------+------------------------------+-------------------------+