The user-defined aggregate
After you complete the aggregate-development steps, the user can use the user-defined aggregate on the defined data type in SQL statements. However, use of the user-defined aggregate does assume the appropriate privileges.
For the tab1 table, which A
table with a complexnum_t column defines, the following query uses
the new SQSUM1 aggregate function on the INTEGER column, col3:
SELECT SQSUM1(col3) FROM tab1;
With the rows that A
table with a complexnum_t column has
inserted, the preceding query yields an INTEGER value of 10201
.
To be able to use SQSUM1 on other data types, you need to ensure that the appropriate aggregate support functions exist for this data type. For example, The SQSUM2 user-defined aggregate shows the definition of a version of the SQSUM aggregate on both an INTEGER and a named row type.