ORACLE VARCHAR2 (n CHAR) format

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

From:

 

Had encountered this problem, then check the forgotten today, with record.

 
Data from the SOURCE table to the TARGET table as long guide to go. The side of the SOURCE format is VARCHAR2 (255 CHAR), TARGET's format is VARCHAR2 (256), the difference between the two format is:
 

 
The use of BYTE storage field of database storage character number, for single byte character set this method is applicable, there are several characters on several BYTE. But if you want to insert the international character of multi byte character set, BYTE and the number of characters are not equal, the BYTE number will be long, cause the data not to go. So ORACLE 9i set the three schemes to solve the problem:
 
1. VARCHAR2(n)
2. VARCHAR2(n BYTE)
3. VARCHAR2(n CHAR)
 
The default length setting options 1 using the NLS_LENGTH_SEMANTICS parameter, the default value is BYTE
Option 2 allows only the largest n BYTE length character storage, and is independent of the number of characters
Option 3 allows the largest n character storage, and BYTE.
 
No matter what kind of format, INSTR, LENGTH, SUBSTR function is calculated according to the number of characters. Using BYTE calculation, use the INSTRB, LENGTHB, SUBSTRB function.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Alvis at November 29, 2013 - 2:07 PM