【區別】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
- LightDB 22.4 新特性之完全相容Oracle varchar2資料型別Oracle資料型別
- NTMySQL中varchar和char型別的區別heeMySql型別
- varchar和char的區別
- 區別值型別資料和引用型別資料型別
- MySQL中資料型別(char(n)、varchar(n)、nchar(n)、nvarchar(n)的區別)MySql資料型別
- 關於mysql設定varchar 欄位的預設值''和null的區別,以及varchar和char的區別MySqlNull
- Oracle long轉為varchar2Oracle
- 關係型資料庫和非關係型資料庫的區別資料庫
- MySQL資料型別操作(char與varchar)MySql資料型別
- 聯機重定義修改欄位型別(NVARCHAR2->VARCHAR2)型別
- MySQL中CHAR和VARCHAR區別MySql
- Oracle 資料型別Oracle資料型別
- rust trait 關聯型別和泛型的區別RustAI型別泛型
- MySQL 中 VARCHAR 最大長度及 CHAR 和 VARCHAR 的區別MySql
- Oracle的number資料型別Oracle資料型別
- Oracle資料型別對應Java型別Oracle資料型別Java
- dg和ogg的區別--oracle資料庫Oracle資料庫
- Oracle和sqlserver資料型別對應OracleSQLServer資料型別
- [20221012]簡單探究nvarchar2資料型別儲存.txt資料型別
- 【轉】ORACLE資料型別Oracle資料型別
- Oracle anydata資料型別Oracle資料型別
- ORACLE NUMBER資料型別Oracle資料型別
- js資料型別之基本資料型別和引用資料型別JS資料型別
- 非關係型資料庫(NOSQL)和關係型資料庫(SQL)區別詳解資料庫SQL
- Java中基本資料型別和包裝型別有什麼區別?Java資料型別
- input的type值型別和描述-HTML型別HTML
- Oracle OCP(19):資料型別Oracle資料型別
- c#中值型別和引用型別的區別C#型別
- Mysql BLOB、BLOB與TEXT區別及效能影響、將BLOB型別轉換成VARCHAR型別MySql型別
- js基本型別和引用型別區別JS型別
- Oracle和MySQL的區別OracleMySql
- MySQL和Oracle的區別MySqlOracle
- JAVA中基本資料型別和引用資料型別Java資料型別
- SQL與NoSQL(關係型與非關係型)資料庫的區別SQL資料庫
- Oracle BLOB型別的資料如何檢視和下載?Oracle型別
- Oracle字串資料型別簡述Oracle字串資料型別
- 資料庫型別區分資料庫型別
- Oracle基本資料型別儲存格式淺析——RAW型別Oracle資料型別