Create SQL-invoked functions
An SQL-invoked function is a user-defined
function that an end user can explicitly call in an SQL statement.
You might write SQL-invoked functions to extend the functionality
of an opaque data type in the following ways:
- Overloading arithmetic or built-in functions to provide arithmetic operations and built-in functions on the opaque data type
- Overloading relational-operator functions to provide comparison operations on the opaque data type
- Writing new end-user routines to provide additional functionality for the opaque data type
- Writing new cast functions to provide additional data conversions to and from the opaque data type
The SQL functions that the database server defines handle the built-in data types. For a UDT to use any of these functions, you can overload the function that handles the UDT. For more information about the details of writing user-defined functions, see Develop a user-defined routine. For information about overloading functions, refer to Routine overloading.
The database server supports the following types
of SQL-invoked functions that allow you to operate on data in expressions
of SQL statements:
- Arithmetic and text operator functions
- Built-in functions
- Aggregate functions
The database server also supports the following types
of functions that allow you to compare data in expressions of SQL
statements:
- SQL operators in a conditional clause
- Relational operator functions