Oracle 字符串长度函数

LENGTH calculates length using characters as defined by the input character set. 

LENGTHB uses bytes instead of characters. 

VSIZE returns the number of bytes in the internal representation of expr.

LENGTHC uses Unicode complete characters. 

LENGTH2 uses UCS2 codepoints. 

LENGTH4 uses UCS4 codepoints 

 

 

select length('adfad合理') "bytesLengthIs" from dual --7

select lengthb('adfad') "bytesLengthIs" from dual --5

select lengthb('adfad合理') "bytesLengthIs" from dual --11

select vsize('adfad合理') "bytesLengthIs" from dual --11

select lengthc('adfad合理')"bytesLengthIs" from dual --7

 

因此,在utf-8的字符集下

lengthb=vsize

lengthc=length

 

utf-8的中文字符占用3个字节,gbk的中文字符占用2个字节,iso-8859-1的中文字符被识别为占用2个字节,iso不支持中文字符的编码,应该是都当成某个拉丁字母了.Oracle没有关系,oracle只是负责存储数据.

可以先用 select * from v$nls_parameters 看看oracle的字符集

你可能感兴趣的:(oracle,存储,input,Parameters,character)