|Oracle9i Application Developer's Guide - Large Objects (LOBs)
Release 1 (9.0.1)
Part Number A88879-01
Modeling and Design, 21 of 21
User-defined aggregates (UDAGs) provide a mechanism for application/cartridge developers, and end-users to implement and deploy new aggregate functions over scalar datatypes (including LOBs) as well as object and opaque types.
The following are two examples of applications for user-defined aggregates (UDAGs):
For example, a query to find the state boundary by unionizing the county boundaries in each state can be executed as follows:
User Defined Aggregate functions (UDAG) refer to aggregate functions with user specified aggregation semantics. You can create a new aggregate function and provide the aggregation logic via a set of routines. Once created, user defined aggregate functions can be used in SQL DML statements like built-in aggregates.
Complex data is typically stored in the database using object types, opaque types or LOBs. User-defined aggregates are useful in specifying aggregation over these domains of data.
UDAGs can also be used to create new aggregate functions over traditional scalar data types for financial or scientific applications. Since, it is not possible to provide native support for all forms of aggregates, this functionality provides you with a flexible way to add new aggregate functions.
An aggregate function takes a set of values as input and returns a single value. The sets of values for aggregation are typically identified using a GROUP BY clause. For example:
UDAGs allow you to register new aggregate functions by providing specific (new) implementations for the above primitive operations.
User-defined aggregate functions have the following DDL support:
User-defined aggregate functions have the following DML and query support: