Previous Topic: When to Use a User-Defined FunctionNext Topic: Invoking a Function


Defining a Function

How to define and deploy user-defined functions depends on the language of the function.

Note: You invoke the SQL function in a way very similar to the way in which you invoke built-in functions.

An example is shown next:

CREATE FUNCTION DEFJE01.UDF_FUNBONUS
  ( EMP_ID         DECIMAL(4)    )
    RETURNS DECIMAL(10)
    EXTERNAL NAME FUNBONUS PROTOCOL IDMS
    DEFAULT DATABASE CURRENT
    USER MODE
    LOCAL WORK AREA 0
    ;

Similarly, use the ALTER FUNCTION and DROP FUNCTION statements to modify and delete the definition of existing functions.

More Information