http://download.oracle.com/docs/cd/B10500_01/server.920/a96529/ch2.htm
Oracle uses the database character set for:
- Data stored in SQL
CHARdatatypes (CHAR,VARCHAR2,CLOB, andLONG) - Identifiers such as table names, column names, and PL/SQL variables
- Entering and storing SQL and PL/SQL source code
The character encoding scheme used by the database is defined as part of the CREATE DATABASE statement. All SQL CHAR datatype columns (CHAR, CLOB, VARCHAR2, and LONG), including columns in the data dictionary, have their data stored in the database character set. In addition, the choice of database character set determines which characters can name objects in the database. SQL NCHAR datatype columns (NCHAR, NCLOB, and NVARCHAR2) use the national character set.
|
Note:
|
After the database is created, you cannot change the character sets, with some exceptions, without re-creating the database.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i3253
NCHAR and NVARCHAR2 Datatypes
NCHAR and NVARCHAR2 are Unicode datatypes that store Unicode character data. The character set of NCHAR and NVARCHAR2 datatypes can only be either AL16UTF16 or UTF8 and is specified at database creation time as the national character set. AL16UTF16 and UTF8 are both Unicode encoding.
-
The
NCHARdatatype stores fixed-length character strings that correspond to the national character set. -
The
NVARCHAR2datatype stores variable length character strings.
When you create a table with an NCHAR or NVARCHAR2 column, the maximum size specified is always in character length semantics. Character length semantics is the default and only length semantics for NCHAR or NVARCHAR2.
For example, if national character set is UTF8, then the following statement defines the maximum byte length of 90 bytes:
CREATE TABLE tab1 (col1 NCHAR(30));
This statement creates a column with maximum character length of 30. The maximum byte length is the multiple of the maximum character length and the maximum number of bytes in each character.
本文详细介绍了Oracle数据库中使用的字符集及其对SQLCHAR数据类型、标识符和源代码的影响。特别关注了NCHAR和NVARCHAR2类型的Unicode特性,包括其存储方式、最大长度限制及与数据库字符集的关系。
470

被折叠的 条评论
为什么被折叠?



