Online Documentation for SQL Manager for DB2

Functions


A Function is a mapping embodied as a program (the function body) that can be invoked by using zero or more input values (arguments) to a single value (the result).

 

 

Creating Functions

 

To create a new function:

Hint: To create a new function, you can also right-click the Functions node of the DB Explorer tree and select the New Function... context menu item.

 

To create a new function with the same properties as one of existing functions has:

Alternatively, you can right-click a function in the DB Explorer tree and select the Duplicate Function <function_name>... context menu item.

 

Duplicate Object Wizard allows you to select the database to create a new function in, and to edit the result SQL statement for creating the function.

 

 

Editing Functions

 

To edit an existing function:

  • select the function for editing in the DB Explorer tree (type the first letters of the function name for quick search);
  • right-click the object and select the Edit Function <function_name>... context menu item, or simply double-click the function;
  • edit function definition using the appropriate tabs of Function Editor.

 

Dropping Functions

 

To drop a function:

  • select the function to drop in the DB Explorer tree;
  • right-click the object and select the Drop Function <function_name>... context menu item;
  • confirm dropping in the dialog window.

 

Note: If more convenient, you can also use the following shortcuts:

Ctrl+N to create a new function;

Ctrl+O to edit the selected function;

Shift+Del to drop the object from the database.