Question

I want to play a little bit with UDFs but I am stuck just at the start: I even can't get the examples from the manuals to work.

The SYSIBM.Version variable for my DB2 system is DSN11015.

Executing the sample code:

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; 

Results in a

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.             

I have no ideas what clauses are mutually exclusive here...

Was it helpful?

Solution

According to the syntax diagram in the manual (http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db2z11.doc.sqlref/src/tpc/db2z_sql_createfunctionexternalscalar.htm) the sequence of options is significant. You may want to try putting DETERMINISTIC and FENCED (in that sequence) before NO SQL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top