OLAP aggregation function expressions

OLAP aggregation function expressions can return aggregate information about rows in the partitioned results of a query.

OLAP aggregation function expressions are OLAP window expressions that you can include in the Projection list of a SELECT statement, or the ORDER BY clause of a SELECT statement.

Syntax

Read syntax diagramSkip visual syntax diagram
OLAP Aggregation function expressions

|--| Aggregation functions |--| OVER clause for Aggregation functions |--|

OLAP Aggregation functions

                              (1)                
|--+-| FIRST_VALUE function |----------------+------------------|
   |                         (2)             |   
   +-| LAST_VALUE function |-----------------+   
   |                              (3)        |   
   +-| RATIO_TO_REPORT function |------------+   
   |                                     (4) |   
   '-| OLAP Window Aggregate functions |-----'   

OVER clause for Aggregation functions

        (5)                                           
|--OVER------(--+---------------------------------+------------->
                |                             (5) |   
                '-| Window PARTITION clause |-----'   

>--+--------------------------------------------------------------+--)--|
   |                         (5)                                  |      
   '-| Window ORDER clause |------+-----------------------------+-'      
                                  |                         (5) |        
                                  '-| Window Frame clause |-----'        

Notes:
  1. See FIRST_VALUE function
  2. See LAST_VALUE function
  3. See RATIO_TO_REPORT function
  4. See OLAP window aggregate functions
  5. See OVER clause for OLAP window expressions

Usage

You can apply the OLAP aggregation functions to subsets of the rows in an OLAP window partition by specifying a window frame.