Oracle String/Char Function - Oracle/PLSQL LENGTHB Function






This Oracle tutorial explains how to use the Oracle/PLSQL function.

The Oracle/PLSQL LENGTHB function calculates the length of a string using bytes not characters.

Syntax

The syntax for the Oracle/PLSQL LENGTHB function is:

LENGTHB( string1 )

string1 is the string to do the calculation.

string1 can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, or single-byte LOB.

If string1 is NULL, LENGTHB returns NULL.

Example

LENGTHB(NULL)
-------------
        NULL
 
 LENGTHB('')
------------
        NULL
 
 LENGTHB(' ')
------------
           1
 
 LENGTHB('java2s.com')
---------------------
                   16