设为首页 加入收藏

TOP

DB2判断汉字长度、对数字字符进行判断(二)
2014-11-23 22:04:38 来源: 作者: 【 】 浏览:21
Tags:DB2 判断 汉字 长度 数字 字符 进行
The expression must return a value that is a built-in CHAR, VARCHAR, GRAPHIC, VARGRAPHIC, numeric, or datetime data type. If the value is not a CHAR, VARCHAR, GRAPHIC, or VARGRAPHIC data type, it is implicitly cast to VARCHAR before eva luating the function.If from-string-exp contains duplicate characters, the first one found will be used, and the duplicates will be ignored. If to-string-exp is longer than from-string-exp, the surplus characters will be ignored. If to-string-exp is specified, from-string-exp must also be specified.
pad-char-exp
Specifies a single character that will be used to pad to-string-exp if to-string-exp is shorter than from-string-exp. The expression must return a value that is a built-in CHAR, VARCHAR, GRAPHIC, VARGRAPHIC, numeric, or datetime data type. If the value is not a CHAR, VARCHAR, GRAPHIC, or VARGRAPHIC data type, it is implicitly cast to VARCHAR before eva luating the function. The value must have a length attribute of zero or one. If a zero-length string is specified, characters in the from-string-exp with no corresponding character in the to-string-exp are removed from char-string-exp or graphic-string-exp. If a value is not specified a single-byte blank character is assumed.
具体实现语句如下:
1
length(trim(translate(r.ITEM,'','0123456789')))=0
这条sql语句简单说明,当ITEM字段的中包含0~9中的任一数字时,就替换为空字符,当全部为数字时,就全部替换为空字符了,通过trim()函数去空格然后length函数一测量,连渣都不剩了.为0.此时就可以判定为全部是数字字符了。
首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇DB2中case的使用 下一篇DB2索引类型介绍

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: