Extending the Functionality of Aggregates
- Extensions of built-in aggregates
A built-in aggregate is an aggregate that the database server provides, such as COUNT, SUM, or AVG. These only support built-in data types. To extend a built-in aggregate so that it supports a user-defined data type (UDT), you must create user-defined routines that overload the binary operators for that aggregate. For further information on extending built-in aggregates, see the HCL OneDB User-Defined Routines and Data Types Developer's Guide.
- Creation of user-defined aggregates
A user-defined aggregate is an aggregate that you define to perform an aggregate computation that the database server does not provide. You can use user-defined aggregates with built-in data types, extended data types, or both. To create a user-defined aggregate, use the CREATE AGGREGATE statement. In this statement, you name the new aggregate and specify the support functions that compute the aggregate result. These support functions perform initialization, sequential aggregation, combination of results, and type conversion.