LENGTH4 function in Oracle

LENGTH4 is one of the vital string/char functions of Oracle. It is used to get the length of a string, same as the LENGTH and the LENGTH2 functions with the only difference that it uses the UCS4 code points. The LENGTH4 function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

LENGTH4 ( string )

Parameters:
string: It is used to specify the string whose length needs to get.

Example 1:

LENGTH4 (NULL)

Output:

NULL

Explanation:
There is no string passed hence the result is NULL.

Example 2:

LENGTH4 (‘’)

Output:

NULL

Explanation:
There is no string passed hence the result is NULL.

Example 3:

LENGTH4 (‘ ’)

Output:

1

Explanation:
The SPACE is passed as a string, hence the result is 1.

Example 4:

LENGTH4 (‘HELLOWORLD.COM)

Output:

14

Explanation:
The total number of characters including the ‘.’ is 14 and so is the result..