oracle 的 length函数与db2的length函数

jin_ok 2008-03-11 05:16:19
在oracle 中 select length('李琳') from dual 返回2
在db2 中select length('李琳') from sysibm.SYSDUMMY1 返回4
db2 有没有返回字符个数的length函数,像oracle一样?
...全文
958 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
若闻 2010-06-10
  • 打赏
  • 举报
回复
LENGTH ( expression, CODEUNITS16/ CODEUNITS32/ OCTETS )
littleboys 2008-03-13
  • 打赏
  • 举报
回复
Db2 9 已经有个这个函数

LENGTH ( expression, CODEUNITS16/ CODEUNITS32/ OCTETS )


CODEUNITS16, CODEUNITS32, or OCTETS Specifies the string unit of the result. CODEUNITS16 specifies that the result is to be expressed in 16-bit UTF-16 code units. CODEUNITS32 specifies that the result is to be expressed in 32-bit UTF-32 code units. OCTETS specifies that the result is to be expressed in bytes. If a string unit is explicitly specified, and if expression is not string data, an error is returned (SQLSTATE 428GC). If a string unit is specified as CODEUNITS16 or CODEUNITS32, and expression is a binary string or bit data, an error is returned (SQLSTATE 428GC). If a string unit is specified as OCTETS and expression is a binary string, an error is returned (SQLSTATE 42815). For more information about CODEUNITS16, CODEUNITS32, and OCTETS, see “String units in built-in functions” in “Character strings”.

5,889

社区成员

发帖
与我相关
我的任务
社区描述
IBM DB2 是美国IBM公司开发的一套关系型数据库管理系统,它主要的运行环境为UNIX(包括IBM自家的AIX)、Linux、IBM i(旧称OS/400)、z/OS,以及Windows服务器版本
社区管理员
  • DB2
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧