Creating DB2 user-defined functions using a wizard

You can use the New UDF wizard to create DB2 user-defined functions (UDFs) in SQL.

Prerequisites: Before you can create a DB2 user-defined function, complete the following prerequisite steps:

To create a user-defined function using the wizard:

  1. Switch to the Data perspective.

  2. In the Data Definition view, right-click the User-Defined Functions folder, and click New > SQL User-defined Function. The New User-Defined Function (UDF) wizard opens.

  3. Complete the steps of the wizard.

  4. Click Finish.

The user-defined function is created and added to your database definition.

Note: The New User-Defined Function (UDF) wizard does not support all data types on all DB2 UDB servers. When creating a table UDF, the wizard recommends SQL data types for the data returned for each column. If the wizard is unable to map a corresponding data type for a column because that data type is not supported, the Data type column on the Results page of the DB Output view will show "not mapped". To fix this, open the generated user-defined function in the editor and change the data type manually.

By default, creating the user-defined function does not register the user-defined function on the database. To build the user-defined function on the database, see Building DB2 routines.

 

Parent topic

DB2 user-defined functions (UDFs)

 

Related concepts

Developing DB2 user-defined functions
Using DB2 user-defined functions in applications

 

Related tasks

Creating DB2 user-defined functions for WebSphere MQ
Copying DB2 database definitions to a local project
Creating a DB2 user-defined function to access Web services

Related reference
User-defined function catalog by DB2 Universal Database server
User-defined function support by type
Stored procedure and user-defined function support by DB2 Universal Database server type