LENGTH function in Oracle

LENGTH is one of the vital string/char functions of Oracle. It is used to get the length of a string. The LENGTH function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

LENGTH ( string )

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

Example 1:

LENGTH (NULL)

Output:

NULL

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

Example 2:

LENGTH (‘’)

Output:

NULL

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

Example 3:

LENGTH (‘ ’)

Output:

1

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

Example 3:

LENGTH (‘HELLO WORLD’)

Output:

11

Explanation: The total number of characters including the SPACE is 11 and so is the result..

Please follow and like us:
Content Protection by DMCA.com