Oracle / PLSQL: LENGTHB Function
This Oracle tutorial explains how to use the Oracle/PLSQL LENGTHB function with syntax and examples.
Description
The Oracle/PLSQL LENGTHB function returns the length of the specified string, using bytes instead of characters.
Syntax
The syntax for the LENGTHB function in Oracle/PLSQL is:
LENGTHB( string1 )
Parameters or Arguments
- string1
- The string to return the length for. string1 can be CHAR, VARCHAR2, NCHAR, NVARCHAR2, or single-byte LOB.
Returns
The LENGTHB function returns a numeric value.
If string1 is NULL, then the LENGTHB function will return NULL.
Applies To
The LENGTHB 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 LENGTHB function examples and explore how to use the LENGTHB function in Oracle/PLSQL.
For example:
LENGTHB(NULL) Result: NULL (single-byte character set) LENGTHB('') Result: NULL (single-byte character set) LENGTHB(' ') Result: 1 (single-byte character set) LENGTHB('TechOnTheNet.com') Result: 16 (single-byte character set) LENGTHB('TechOnTheNet.com ') Result: 17 (single-byte character set)
Advertisements