SQL-J Language Reference,
Page 88 of 118


[top]
[prev]
[next]
Documentation Top
Global Index
Reference Manual
TOC Index
Grammar index
Developer's Guide
TOC Index
Tuning Cloudscape
TOC Index

User-DefinedAggregate

Cloudscape allows you to create your own aggregate functions. After you create the Java classes that implement the aggregation and create the aggregate with the CREATE AGGREGATE statement, you can use those aggregate from within SQL-J the same way you use the built-in aggregates.

The resulting data type of the user-defined aggregate function is defined by the implementing class. If you provide the correct implementation, a user-defined aggregate can return any built-in type or any user-defined Java data type.

For information about creating the Java classes that implement the aggregation, see “Programming User-Defined Aggregates” in the Cloudscape Developer’s Guide.

Syntax

AggregateName ( [ DISTINCT | ALL ] Expression )

Examples

-- MAXBUTONE is a user-defined aggregate
SELECT MAXBUTONE(DISTINCT miles)
FROM Flights
SELECT STDEV(flying_time)
FROM Flights

NEW: User-defined aggregates are new in Version 3.0.

[top]
[prev]
[next]


Cloudscape Version 3.0
For technical support, go to: www.cloudscape.com and click Support.
Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved.