You can use the New User-Defined Function wizard to create DB2® user-defined functions (UDFs)
in SQL.
Prerequisite: You must create a data development project.
To create a user-defined function from a data development
project:
- Switch to the Data perspective.
- In the Data Project Explorer, right-click the User-Defined
Functions folder in a data development project, and click
New. The New User-Defined
Function wizard opens.
- Complete the steps of the wizard. If you opened
the wizard by using the toolbar button, you must provide project and
connection information in the wizard.
- Click Finish.
The wizard creates the user-defined function and adds it to
the
User-Defined Functions folder, and the
user-defined function opens in the routine editor.
Note: The New User-Defined
Function (UDF) wizard does not support all data types on all DB2 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 SQL Results 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 register the user-defined function on
the database, you must deploy it.