oracle设置字符串长度,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的字符集

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值