【區別】Oracle官方文件中有關NVARCHAR2、VARCHAR2和VARCHAR資料型別的描述
Oralce官方文件“Datatypes”部分對NVARCHAR2、VARCHAR2以及VARCHAR有一段描述,可以清晰得到它們的區別。羅列在此,供大家參考。
【連結】
NVARCHAR2 Datatype
The NVARCHAR2 datatype is a Unicode-only datatype. When you create a table with an NVARCHAR2 column, you supply the maximum number of characters it can hold. Oracle subsequently stores each value in the column exactly as you specify it, provided the value does not exceed the maximum length of the column.
The maximum length of the column is determined by the national character set definition. Width specifications of character datatype NVARCHAR2 refer to the number of characters. The maximum column size allowed is 4000 bytes. Please refer to Oracle Database Globalization Support Guide for information on Unicode datatype support.
VARCHAR2 Datatype
The VARCHAR2 datatype specifies a variable-length character string. When you create a VARCHAR2 column, you supply the maximum number of bytes or characters of data that it can hold. Oracle subsequently stores each value in the column exactly as you specify it, provided the value does not exceed the column's maximum length of the column. If you try to insert a value that exceeds the specified length, then Oracle returns an error.
You must specify a maximum length for a VARCHAR2 column. This maximum must be at least 1 byte, although the actual string stored is permitted to be a zero-length string (''). You can use the CHAR qualifier, for example VARCHAR2(10 CHAR), to give the maximum length in characters instead of bytes. A character is technically a code point of the database character set. CHAR and BYTE qualifiers override the setting of the NLS_LENGTH_SEMANTICS parameter, which has a default of bytes. For performance reasons, Oracle recommends that you use the NLS_LENGTH_SEMANTICS parameter to set length semantics and that you use the BYTE and CHAR qualifiers only when necessary to override the parameter. The maximum length of VARCHAR2 data is 4000 bytes. Oracle compares VARCHAR2 values using nonpadded comparison semantics.
To ensure proper data conversion between databases with different character sets, you must ensure that VARCHAR2 data consists of well-formed strings. See Oracle Database Globalization Support Guide for more information on character set support.
VARCHAR Datatype
Do not use the VARCHAR datatype. Use the VARCHAR2 datatype instead. Although the VARCHAR datatype is currently synonymous with VARCHAR2, the VARCHAR datatype is scheduled to be redefined as a separate datatype used for variable-length character strings compared with different comparison semantics.
【注意】
VARCHAR2是Oracle提供的特定資料型別,Oracle可以保證VARCHAR2在任何版本中該資料型別都可以向上和向下相容。
VARCHAR在Oracle中不建議使用。
-- The End --
【連結】
NVARCHAR2 Datatype
The NVARCHAR2 datatype is a Unicode-only datatype. When you create a table with an NVARCHAR2 column, you supply the maximum number of characters it can hold. Oracle subsequently stores each value in the column exactly as you specify it, provided the value does not exceed the maximum length of the column.
The maximum length of the column is determined by the national character set definition. Width specifications of character datatype NVARCHAR2 refer to the number of characters. The maximum column size allowed is 4000 bytes. Please refer to Oracle Database Globalization Support Guide for information on Unicode datatype support.
VARCHAR2 Datatype
The VARCHAR2 datatype specifies a variable-length character string. When you create a VARCHAR2 column, you supply the maximum number of bytes or characters of data that it can hold. Oracle subsequently stores each value in the column exactly as you specify it, provided the value does not exceed the column's maximum length of the column. If you try to insert a value that exceeds the specified length, then Oracle returns an error.
You must specify a maximum length for a VARCHAR2 column. This maximum must be at least 1 byte, although the actual string stored is permitted to be a zero-length string (''). You can use the CHAR qualifier, for example VARCHAR2(10 CHAR), to give the maximum length in characters instead of bytes. A character is technically a code point of the database character set. CHAR and BYTE qualifiers override the setting of the NLS_LENGTH_SEMANTICS parameter, which has a default of bytes. For performance reasons, Oracle recommends that you use the NLS_LENGTH_SEMANTICS parameter to set length semantics and that you use the BYTE and CHAR qualifiers only when necessary to override the parameter. The maximum length of VARCHAR2 data is 4000 bytes. Oracle compares VARCHAR2 values using nonpadded comparison semantics.
To ensure proper data conversion between databases with different character sets, you must ensure that VARCHAR2 data consists of well-formed strings. See Oracle Database Globalization Support Guide for more information on character set support.
VARCHAR Datatype
Do not use the VARCHAR datatype. Use the VARCHAR2 datatype instead. Although the VARCHAR datatype is currently synonymous with VARCHAR2, the VARCHAR datatype is scheduled to be redefined as a separate datatype used for variable-length character strings compared with different comparison semantics.
【注意】
VARCHAR2是Oracle提供的特定資料型別,Oracle可以保證VARCHAR2在任何版本中該資料型別都可以向上和向下相容。
VARCHAR在Oracle中不建議使用。
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-619844/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 中varchar2 和nvarchar2區別Oracle
- Oracle 資料型別CHAR, NCHAR, VARCHAR2, NVARCHAR2Oracle資料型別
- Oracle中NVARCHAR2與VARCHAR2的區別Oracle
- varchar2 與 nvarchar2 區別
- Oracle的資料型別:char/varchar2Oracle資料型別
- Oracle CHAR,VARCHAR,VARCHAR2,nvarchar型別的區別與使用Oracle型別
- char ,varchar2和varchar的區別
- 【基礎】Oracle CHAR,VARCHAR,VARCHAR2,nvarchar型別的區別與使用Oracle型別
- char nchar varchar2 nvarchar2 區別-Oracle (varchar2 max 4K, 2K漢字)Oracle
- char和varchar2的區別
- VARCHAR2(N CHAR)與VARCHAR2(N)的區別[Oracle基礎]Oracle
- oracle中char與varchar2的區別Oracle
- char(n)和varchar2(n)區別
- 12c 新特性之varchar2,nvarchar2型別大小測試型別
- PLSQL Language Reference-PL/SQL資料型別-SQL資料型別-CHAR和VARCHAR2變數SQL資料型別變數
- oracle如何變更varchar2型別的列為clobOracle型別
- MySQL字元資料型別char與varchar的區別MySql字元資料型別
- long型別轉換成varchar2型別
- LightDB 22.4 新特性之完全相容Oracle varchar2資料型別Oracle資料型別
- Oracle varchar2型別欄位插入插入過長資料丟失問題Oracle型別
- SQL中給varchar2(5)資料型別合適的約束SQL資料型別
- NTMySQL中varchar和char型別的區別heeMySql型別
- 區別值型別資料和引用型別資料型別
- MySQL CHAR和VARCHAR資料型別介紹MySql資料型別
- varchar和char的區別
- 保留資料庫表中的資料,把表中的欄位varchar2改成clob型別資料庫型別
- long查詢結果轉換為varchar2型別型別
- 關係型資料庫和非關係型資料庫的區別資料庫
- 你或許不知道的varchar2型別的定義型別
- 【原創】Oracle number date varchar2欄位型別佔用空間大小Oracle型別
- 關於mysql設定varchar 欄位的預設值''和null的區別,以及varchar和char的區別MySqlNull
- JavaScript 基本資料型別和引用型別的區別詳解JavaScript資料型別
- MySQL資料型別操作(char與varchar)MySql資料型別
- 資料庫中varchar和Nvarchar區別與聯絡資料庫
- MySQL中資料型別(char(n)、varchar(n)、nchar(n)、nvarchar(n)的區別)MySql資料型別
- 把非空的欄位number(7,4)的資料合理轉行成varchar2(32)型別型別
- MySQL中CHAR和VARCHAR區別MySql
- 對論壇中有關資料型別轉換的總結 (轉)資料型別