Oracle data type of problem

Do projects related to the Oracle database data types: string problem

  I do not know varchar (32) in the end represents what?

  By searching learned: oracle There are three common types: varchar2 (byte), varchar2 (char), nvarchar2 ()

  varchar2 (byte): default representation, VARCHAR2 (100), equivalent to varchar2 (100 byte), represents the maximum number of bytes is 100, emphasis space. If the database using GBK encoded, a Chinese character occupies 2 bytes, if the UTF8, a character occupying 3 bytes

  varchar2 (char): represents the maximum number of characters is 100, the number of stressed. Whether it is numbers, letters, Chinese characters are a character, write up to 100, of course, the more characters, the greater the space occupied, as a Chinese character 2 or 3 bytes.

  nvarchar2 (): no sub-byte character, the similar varchar2 (char), but NVARCHAR2 () coding mask database, no matter what kind of coding, NVARCHAR2 () in a character occupies 2 bytes

  Practical applications, there may be such wording: nvarchar2 (1400char), everything seems normal, but in reality not, if all the characters, then 1400 * 3 bytes more than we say 4000 bytes, the extra data is It is not stored

  Therefore, for GBK encoding is: Security is written varchar2 (2000char), nvarchar2 (2000)

  For UTF8 encoding is: safe wording is varchar2 (1333), nvarchar2 (2000)

The main reference article: http://www.luoxiao123.cn/oracle_varchar2_trap.html

Guess you like

Origin www.cnblogs.com/superhonors/p/11318126.html