WINDOW (IN SQL MODEL) (SORT)

Description

Execute an analytic function within a SQL Model (Spreadsheet)

Versions

This operation was introduced in Oracle 10.2

This operation is implemented in the following versions

10.2.0

Example

This example was developed using Oracle 10.2.0.1 on Linux

This example requires the following table definition

    CREATE TABLE t1
    (
      c1 NUMBER,
      c2 NUMBER,
      c3 NUMBER
    );

The table does not need to be analyzed

The statement

    SELECT c1,a1,a2
    FROM
    (
      SELECT c1,SUM(c2) a1
      FROM t1
      GROUP BY c1
    )
    MODEL DIMENSION BY (c1)
    MEASURES (a1,0 a2)
    RULES 
    (
      a2[any] = SUM (a1) OVER ()
    )
    ORDER BY c1; 

generates the following execution plan

0     SELECT STATEMENT Optimizer=CHOOSE
1   0   SORT (ORDER BY)
2   1     SQL MODEL (ORDERED)
3   2       HASH (GROUP BY)
4   3         TABLE ACCESS (FULL) OF 'T1'
5   4           WINDOW (IN SQL MODEL) (SORT)