今天同事的项目碰见了乱码问题,查了基本情况以后,我认为他们没有弄清楚数据库字符集和国家语言字符集的区别。查资料后,叙述如下:
原文:
Character Set Types
The CREATE DATABASE statement has the CHARACTER SET clause and the
additional optional clause NATIONAL CHARACTER SET to declare the character set
to be used as the database character set and the national character set. Neither
character set can be changed after creating the database. If no NATIONAL
CHARACTER SET clause is present, the national character set defaults to the
database character set.
Because the database character set is used to identify and to hold SQL and PL/SQL
source code, it must have either EBCDIC or 7-bit ASCII as a subset, whichever is
native to the platform. Therefore, it is not possible to use a fixed-width, multibyte
character set as the database character set, only as the national character set.
The data types NCHAR, NVARCHAR2, and NCLOB are provided to declare columns
as variants of the basic types CHAR, VARCHAR2, and CLOB, to note that they are
stored using the national character set and not the database character set.
To declare a fixed-length character item that uses the national character set, use the
data type specification NCHAR [(size)].
To declare a variable-length character item that uses the national character set, use
the data type specification NVARCHAR2 (size).
To declare a character large object (CLOB) item containing fixed-width, multibyte
characters that uses the national character set, use the data type specification
NCLOB (size).
译文:
字符集类型
CREATE DATABASE语句中有CHARACTER SET从句和附加的NATIONAL CHARACTER SET从句用来定义
数据库的字符集和国家字符集。这两个字符集在数据库创建之后都无法修改。如果不指明NATIONAL
CHARACTER SET从句,则国家字符集缺省取数据库字符集。
因为数据库字符集用于标识并装载SQL和PL/SQL源代码,所以数据库字符集必须将EBCDIC或7位ASCII
作为子集。因此,固定宽度,多字节字符集不可能作为数据库字符集,而只能作为国家字符集。数据类型
NCHAR,NVARCHAR2和NCLOB是基本数据类型CHAR,VARCHAR2和BLOB的变体,来指明它们用国家字符集而
不是数据库字符集存储数据。
NCHAR用于使用国家字符集定义固定长度的字符项。
NVARCHAR2用于使用国家字符集定义变长度的字符项。
NCLOB用于使用国家字符集定义字符大对象,来保存固定宽度,多字节字符。
数据库字符集存储变宽度字符,国家字符集存储固定宽度和变宽度多字节字符。
异星工厂太空时代游戏总结
1 天前
没有评论:
发表评论