SQL MODEL (ORDERED)

Description

Create a SQL Model (Spreadsheet) using SEQUENTIAL ORDER

Versions

This operation was introduced in Oracle 10.1

This operation is implemented in the following versions

10.1.0
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
    );

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 SEQUENTIAL ORDER
    (
      a2[any] = a1[CV()]
    )
    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'