org.jooq
Interface OrderedAggregateFunction<T>


public interface OrderedAggregateFunction<T>

An ordered aggregate function.

An ordered aggregate function is an aggregate function with a mandatory Oracle-specific WITHIN GROUP (ORDER BY ..) clause. An example is LISTAGG:

 SELECT   LISTAGG(TITLE, ', ')
          WITHIN GROUP (ORDER BY TITLE)
 FROM     T_BOOK
 GROUP BY AUTHOR_ID
 
The above function groups books by author and aggregates titles into a concatenated string.

Ordered aggregate functions can be further converted into window functions using the OVER(PARTITION BY ..) clause. For example:

 SELECT LISTAGG(TITLE, ', ')
        WITHIN GROUP (ORDER BY TITLE)
        OVER (PARTITION BY AUTHOR_ID)
 FROM   T_BOOK
 

Author:
Lukas Eder

Method Summary
 AggregateFunction<T> withinGroupOrderBy(Collection<SortField<?>> fields)
          Add an WITHIN GROUP (ORDER BY ..)
 AggregateFunction<T> withinGroupOrderBy(Field<?>... fields)
          Add an WITHIN GROUP (ORDER BY ..)
 AggregateFunction<T> withinGroupOrderBy(SortField<?>... fields)
          Add an WITHIN GROUP (ORDER BY ..)
 

Method Detail

withinGroupOrderBy

AggregateFunction<T> withinGroupOrderBy(Field<?>... fields)
Add an WITHIN GROUP (ORDER BY ..) clause to the ordered aggregate function


withinGroupOrderBy

AggregateFunction<T> withinGroupOrderBy(SortField<?>... fields)
Add an WITHIN GROUP (ORDER BY ..) clause to the ordered aggregate function


withinGroupOrderBy

AggregateFunction<T> withinGroupOrderBy(Collection<SortField<?>> fields)
Add an WITHIN GROUP (ORDER BY ..) clause to the ordered aggregate function



Copyright © 2012. All Rights Reserved.