Text data is encoded/stored/transformed on the computer in bytes thanks to a character set that maps text to bytes.
Historically, the character sets were single-byte character sets that could hold 256 characters. It meant that one character needed only one byte. But with the globalization of the world, it was not enough anymore to hold all character's languages, and the multi-byte character sets were born.
The issues are that :
Leadings to these Oracle errors :
The VARCHAR2 and CHAR SQL data types support two methods of specifying lengths:
VARCHAR2(10 byte)
VARCHAR2(10 char)
The session or system parameter NLS_LENGTH_SEMANTICS changes the default text length unit from BYTE to CHAR.
alter session set nls_length_semantics=char;
alter session set nls_length_semantics=byte;
alter system set nls_length_semantics=char scope=both;
alter system set nls_length_semantics=byte scope=both;
You can specify the length unit in the textual functions by choosing:
For instance,
SUBSTR('abcdefg',3,4)
SUBSTRB('abcdefg',3,4)