REGEXP_LIKE 在 DB2 v7r1(7.1?)

REGEXP_LIKE in DB2 v7r1 (7.1?)

来自,

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/db2/rbafzregexp_like.htm

SELECT PID FROM PRODUCT 
 WHERE NOT REGEXP_LIKE(pid,'[0-9]{3}-[0-9]{3}-[0-9]{2}')

但是当我运行一个类似的命令时,

SELECT MYCOLUMN FROM MYTABLE 
 WHERE NOT REGEXP_LIKE(MYCOLUMN,'[0-9]{3}-[0-9]{3}-[0-9]{2}')

我明白了

SQL State: 42601 Vendor Code: -104 Message: [SQL0104] Token was not valid. Valid tokens: < > = <> <= !< !> !=

= ¬< ¬> ¬= IN. Cause . . . . . : A syntax error was detected at token . Token is not a valid token. A partial list of valid tokens is < > = <> <= !< !> != >= ¬< ¬> ¬= IN. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token . Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is , correct the SQL statement because it does not end with a valid clause.

为什么这个例子不起作用? IBM v7r1 和 7.1 不一样吗?

7.1 和 v7r1 是同一回事...

作为技术更新 (TR) 级别 9 的一部分添加了正则表达式支持

从命令行使用“使用 PTF 组 (WRKPTFGRP)”命令

WRKPTFGRP PTFGRP(SF99707) PTFGRPLVL(*INSTALLED)

此外,您需要安装 5770-SS1 选项 #39 Unicode 国际组件。您可以使用显示软件资源 (DSPSFWRSC) 进行检查。

如果未安装,您会看到一条消息:
SQL0204 - QSYS 类型 *SRVPGM 中的 QQQSVREG 未找到。