标签:
2.2字符编码方案
2.2.1 单字节编码
(1)单字节7位字符集,可以定义128个字符,最常用的字符集为 US7ASCII
(2)单字节8位字符集,可以定义256个字符,适合于欧洲大部分国家
例如:WE8ISO8859P1(西欧、8位、ISO标准8859P1编码 )
2.2.2 多字节编码
(1)变长多字节编码
某些字符用一个字节表示,其它字符用两个或多个字符表示,变长多字节编码常用于对亚洲语言的支持, 例如日语、汉语、印地语等
例如:AL32UTF8(其中AL代表ALL,指适用于所有语言)、 zhs16cgb231280
(2)定长多字节编码
每一个字符都使用固定长度字节的编码方案,目前oracle唯一支持的定长多字节编码是AF16UTF16,也是仅用于国家字符集
2.2.3 unicode 编码
Unicode 是一个涵盖了目前全世界使用的所有已知字符的单一编码方案,也就是说Unicode为每一个字符提供唯一的编码。UTF-16是unicode的16位编码方式,是一种定长多字节编码,用2个字节表示一个unicode字符,AF16UTF16是UTF-16编码字符集。
UTF-8 是unicode的8位编码方式,是一种变长多字节编码,这种编码可以用1、2、3个字节表示一个unicode字符,AL32UTF8,UTF8、UTFE是UTF-8编码字符集
Syntax
length::=
Description of the illustration length.gif
Purpose
The LENGTH
functions return the length of char
. LENGTH
calculates length using characters as defined by the input character set. LENGTHB
uses bytes instead of characters. LENGTHC
uses Unicode complete characters. LENGTH2
uses UCS2 code points. LENGTH4
uses UCS4 code points.
char
can be any of the data types CHAR
, VARCHAR2
, NCHAR
, NVARCHAR2
, CLOB
, or NCLOB
. The exceptions are LENGTHC
, LENGTH2
, and LENGTH4
, which do not allow char
to be a CLOB
or NCLOB
. The return value is of data type NUMBER
. If char
has data type CHAR
, then the length includes all trailing blanks. If char
is null, then this function returns null.
Restriction on LENGTHB The LENGTHB
function is supported for single-byte LOBs only. It cannot be used with CLOB
and NCLOB
data in a multibyte character set.
Examples
The following example uses the LENGTH
function using a single-byte database character set:
SELECT LENGTH(‘CANDIDE‘) "Length in characters" FROM DUAL; Length in characters -------------------- 7
The next example assumes a double-byte database character set.
SELECT LENGTHB (‘CANDIDE‘) "Length in bytes" FROM DUAL; Length in bytes --------------- 14
标签:
原文地址:http://www.cnblogs.com/iyoume2008/p/5181895.html