DB2 查询中的数字和字母数字检查

Numeric and alpha numeric check in DB2 query

我的要求是在 DB2 查询中检查该值是数字还是字母数字,我没有在 DB2 中获得任何可用的函数。所以任何想法都一样。

如何使用 XQuery function fn:matches() in DB2 to check for numeric or alphanumeric strings based on a regular expression is documented in one of the answers here 的示例。核心思想在这里:

xmlcast( xmlquery('fn:matches($YOUR_STRING,"your pattern")') as integer) = 1

问题是您如何定义字母数字或数字。有些不错regular expressions are in this discussion.