Creating a UDAF written in C++
This section describes how to create, on a Db2® system, a user-defined aggregate function (UDAF) written in C++.
Note: Unlike a UDSF or UDTF, which can use the instantiate method
to initialize class variables for use during the entire invocation
period of the function (and across multiple rows of data), the class
variables of a UDAF are localized to each phase. The best way for
a UDAF to achieve a similar effect is for it to use something like
Extended Scratchpad or the Aggregate States itself to share common
variables.