Implementing Db2 user-defined functions
In contrast to built-in Db2 functions, you can create and implement your own functions to simplify your queries.
There are three primary types of user-defined functions.
- Sourced functions
- Functions that are based on existing functions.
- External functions
- Functions that are developed by users.
- SQL functions
- Functions that are defined to the database by use of SQL statements only.
External user-defined functions can return a single value or a table of values.
- External functions that return a single value are called user-defined scalar functions.
- External functions that return a table are called user-defined table functions.
User-defined functions, like built-in functions or operators, support the manipulation of distinct types.