orcale 中varchar2 和nvarchar2的区别

orcale 中varchar2 和nvarchar2的区别
2008-05-20 17:48
orcale 中varchar2 和nvarchar2的区别
在sql ref书中介绍到
1 VARCHAR2(size)
        [BYTE | CHAR]
        Variable-length character string having maximum
        length size bytes or characters. Maximum size is
        4000 bytes, and minimum is 1 byte or 1 character.
        You must specify size for VARCHAR2.
        BYTE indicates that the column will have byte
        length semantics; CHAR indicates that the column
        will have character semantics.
1 NVARCHAR2(size) Variable-length character string having maximum
        length size characters or bytes, depending on the
        choice of national character set. Maximum size is
        determined by the number of bytes required to store
        each character, with an upper limit of 4000 bytes.
        You must specify size for NVARCHAR2.
中文大意:
VARCHAR2(size),可变长度的字符串,其最大长度为 size 个字节。size 的最大值是 4000,而最小值是 1。您必须指定一个 VARCHAR2 的 size。 
NVARCHAR2(size),可变长度的字符串,依据所选的国家字符集,其最大长度为 size 个字符或字节。size 的最大值取决于存储每个字符所需要的字节数,其上限为 4000 个字节。您必须为 NVARCHAR2 指定一个 size。 

相同点:都是可变长度字符串(char类型是不变长度),都必须指定大小
不同点:VARCHAR2存放的英文字符只占一个字节,而nvarchar2依据所选的字符集,大多为两个

总结:在存贮一些特殊的字符时应选用nvarchar2,然而varchar2比较节省空间
posted @ 2011-10-27 11:57  sqlite例子  阅读(397)  评论(0编辑  收藏  举报