Create user-defined aggregates

These topics describe how to extend the functionality of aggregates in the database server.

An aggregate is a function that returns one value for a set of queried rows. The database server provides two ways to extend aggregates:
  • Extensions of built-in aggregates

    A built-in aggregate is an aggregate that the database server provides, such as COUNT, SUM, or AVG. You can extend the built-in aggregates for use with UDTs.

  • User-defined aggregates

    A user-defined aggregate is an aggregate that you define to provide an aggregate function that the database server does not provide.

The term user-defined aggregates is often used loosely to include both extensions of built-in aggregates and new, user-defined aggregates. The database server manages all aggregates, whether built in or user defined. After you create an extension to the aggregate system, you use all aggregates in the same way, regardless of how the aggregate was created.

The techniques for providing the two types of extensions are different. These topics provide separate discussions of the two methods for extending aggregates.

For information about how to use aggregates in SELECT statements, refer to the HCL OneDB™ Guide to SQL: Tutorial. For information about the syntax of aggregates, refer to the HCL OneDB Guide to SQL: Syntax.