This Oracle tutorial explains how to use the Oracle/PLSQL LENGTHB function with syntax and examples.
The Oracle/PLSQL LENGTHB function returns the length of the specified string, using bytes instead of characters.
The syntax for the LENGTHB function in Oracle/PLSQL is:
LENGTHB( string1 )
The string to return the length for. string1 can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, or single-byte LOB.
The LENGTHB function returns a numeric value. If string1 is NULL, then the LENGTHB function will return NULL.
The LENGTHB function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle LENGTHB function examples and explore how to use the LENGTHB function in Oracle/PLSQL.
For example:
LENGTHB(NULL)
Output: NULL (single-byte character set)
LENGTHB('')
Output: NULL (single-byte character set)
LENGTHB(' ')
Output: 1 (single-byte character set)
LENGTHB('aodba.com')
Output: 16 (single-byte character set)
LENGTHB('aodba.com ')
Output: 17 (single-byte character set)