Oracle / PLSQL: LENGTHC Function

This article is written about how to use the Oracle/PLSQL LENGTHC function with syntax and examples.

Description

The Oracle/PLSQL LENGTHC function returns the length of the specified string, using Unicode complete characters.

Syntax

The syntax for the LENGTHC function in Oracle/PLSQL is:

LENGTHC( string1 )

Parameters or Arguments

string1

The string to return the length for. string1 can be CHAR, VARCHAR2, NCHAR, or NVARCHAR2. string1 can not be CLOB or NCLOB.

Returns

The LENGTHC function returns a numeric value.

If string1 is NULL, then the LENGTHC function will return NULL.

Applies To

The LENGTHC function can be used in the following versions of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

Example

Let’s look at some Oracle LENGTHC function examples and explore how to use the LENGTHC function in Oracle/PLSQL.

For example:

LENGTHC(NULL)
Result: NULL

LENGTHC('')
Result: NULL

LENGTHC(' ')
Result: 1

LENGTHC('TechOnTheNet.com')
Result: 16

LENGTHC('TechOnTheNet.com ')
Result: 17