Built-in Aggregates

Built-in aggregates are aggregate functions that are defined by the database server, such as AVG, SUM, and COUNT. These aggregates work only with built-in data types, such as INTEGER and FLOAT. You can extend these built-in aggregates to work with extended data types. To extend built-in aggregates, you must create UDRs that overload several binary operators.

After you overload the binary operators for a built-in aggregate, you can use that aggregate with an extended data type in an SQL statement. For example, if you have overloaded the plus operator for the SUM aggregate to work with a specified row type and assigned this row type to the complex column of the complex_tab table, you can apply the SUM aggregate to the complex column:
SELECT SUM(complex) FROM complex_tab;

For more information on how to extend built-in aggregates, see HCL OneDB™ User-Defined Routines and Data Types Developer's Guide. For information on how to invoke built-in aggregates, see the descriptions of individual built-in aggregates in the following pages.