Extending a built-in aggregate

About this task

When you extend a built-in aggregate to include a UDT, you do not use the CREATE AGGREGATE statement because the aggregate itself already exists.

To extend a built-in aggregate:

Procedure

  1. Develop support functions to overload the required operators.
  2. Register each function with a CREATE FUNCTION statement.

    For more information, refer to Registering a user-defined routine.

Results

After you register the support functions that overload the binary operators, you can use the built-in aggregates in an SQL statement.

For the syntax of the CREATE FUNCTION statement, see the HCL OneDB™ Guide to SQL: Syntax. For more information about how to write overloaded functions, refer to Routine overloading. For information about how to write functions in external languages, refer to the HCL OneDB DataBlade® API Programmer's Guide or the HCL® J/Foundation Developer's Guide.