Example: Exponentiation

 

Suppose that you write an external function to perform exponentiation of floating point values, and you want to register it in the MATH schema.

     CREATE FUNCTION MATH.EXPON (DOUBLE, DOUBLE) 
       RETURNS DOUBLE 
       EXTERNAL NAME 'MYLIB/MYPGM(MYENTRY)' 
       LANGUAGE C 
       PARAMETER STYLE DB2SQL 
       NO SQL 
       DETERMINISTIC        NO EXTERNAL ACTION 
       RETURNS NULL ON NULL INPUT        ALLOW PARALLEL

In this example, the RETURNS NULL ON NULL INPUT is specified since you want the result to be NULL if either argument is NULL. As there is no reason why EXPON cannot be parallel, the ALLOW PARALLEL value is specified.

 

Parent topic:

Registering UDFs