Selecting LENGTHB of an NVARCHAR2 does not return the byte length
(Doc ID 2390023.1)
Last updated on APRIL 24, 2018
Applies to:Oracle Forms - Version 10.1.2 to 220.127.116.11.0 [Release 10.1.2 to 12.2]
Information in this document applies to any platform.
In PLSQL LENGTHC is a function that returns the length of the specified string using characters. LENGTHB is a function that returns the length of the specified string using bytes instead of characters.
When trying to select the LENGTHB of an NVARCHAR2 from Forms the value is not accurate. The NVARCHAR2 datatype is used to store Unicode data for specified columns without changing the primary character set of the database. For example:
procedure p is
c2 nvarchar2(10) := 'ABCDE';
text_io.put_line('Byte length of c2 is '||lengthb(c2));
text_io.put_line('Char length of c2 is '||lengthc(c2));
Byte length of c2 is 5
Char length of c2 is 5
The number of bytes should be 10 in this case.
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!