Use the DROP AGGREGATE statement to drop a user-defined aggregate that you created with the CREATE AGGREGATE statement.

This statement is an extension to the ANSI/ISO standard for SQL.


1  DROP AGGREGATE? IF EXISTS?   owner  .  aggregate
Element Description Restrictions Syntax
aggregate Name of the user-defined aggregate to be dropped Must have been previously created with the CREATE AGGREGATE statement Identifier
owner Owner of the aggregate Must own the aggregate Owner name


Dropping a user-defined aggregate does not drop the support functions that you defined for the aggregate in the CREATE AGGREGATE statement. The database server does not track dependency of SQL statements on user-defined aggregates that you use in the statements. For example, you can drop a user-defined aggregate that is used in an SPL routine.

The following example drops the user-defined aggregate named my_avg:

If you include the optional IF EXISTS keywords, the database server takes no action (rather than sending an exception to the application) if no aggregate with the specified name is registered in the current database.