我想在UDF上玩一点但是我刚开始就陷入困境:我甚至无法从手册中获取示例。
我的DB2系统的SYSIBM.Version变量是DSN11015。
执行示例代码:
CREATE FUNCTION FINDSTRING (BLOB(500K), VARCHAR(200))
RETURNS INTEGER
CAST FROM FLOAT
SPECIFIC FINDSTRINBLOB
EXTERNAL NAME FNDBLOB
LANGUAGE C
PARAMETER STYLE SQL
NO SQL
DETERMINISTIC
NO EXTERNAL ACTION
FENCED
STOP AFTER 3 FAILURES;
结果
DSNT408I **SQLCODE = -628**, ERROR: THE CLAUSES ARE MUTUALLY EXCLUSIVE
DSNT418I SQLSTATE = 42613 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNHSMS1 SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = 9 0 0 -1 73 2905 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'00000009' X'00000000' X'00000000'
X'FFFFFFFF' X'00000049' X'00000B59' SQL DIAGNOSTIC
INFORMATION
BPA0012E: DB2 SQL/DDL ERROR HAS OCCURRED - ROLLBACK ISSUED.
我不知道这里的条款是互相排斥的......
答案 0 :(得分:1)
根据手册(http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db2z11.doc.sqlref/src/tpc/db2z_sql_createfunctionexternalscalar.htm)中的语法图,选项序列非常重要。您可以尝试在DETERMINISTIC
之前尝试FENCED
和NO SQL
(在该序列中)。