Skip Headers

Oracle9i OLAP Developer's Guide to the OLAP DML
Release 2 (9.2)

Part Number A95298-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Aggregating Data, 8 of 12


How to Calculate Data at Runtime

The AGGREGATE function calculates the complement of the data specified in the PRECOMPUTE clause of the RELATION command. It returns those values that are currently in status.

For example, if you are using an aggregation map that contains this RELATION command:

RELATION letter.letter PRECOMPUTE ('aa')

Then the AGGREGATE function calculates all aggregations except aa, as shown here.

REPORT AGGREGATE(units USING letter.aggmap)

                 AGGREGATE(UNITS
LETTER         USING LETTER.AGGMAP)
-------------- --------------------
a                                 3
aa                               NA
ab                                3
aab                               2
aba                               1
abb                               2
aaaa                              1
aaba                              2
abaa                              1
abbb                              1
abba                              1

Setting Up Calculation on the Fly

If you want to calculate some data on the fly, you need to perform the following steps:

  1. Decide which data should be pre-calculated and which data should be calculated on the fly.
  2. Define an aggregation map that contains the PRECOMPUTE keyword in one or more RELATION or MODEL commands. It may also contain a CACHE command if the default value is not appropriate.
  3. Use the AGGREGATE command with the aggregation map to pre-calculate the data that will be stored on disk.
  4. Compile the aggregation map after executing the AGGREGATE command, as explained in "How to Compile an Aggregation Map".
  5. Add the $NATRIGGER property to the variables that use the aggregation map, so that NAs in queried data will cause the AGGREGATE function to execute.

Adding the $NATRIGGER Property to a Variable

Instead of specifying the AGGREGATE function in every command that you want to return aggregate data, you can add a property to the variable so that the AGGREGATE function is executed automatically.

An $NATRIGGER property on a variable indicates that NA values in the queried data will cause a particular action to take place. To trigger an aggregation, a call to the AGGREGATE function is the value assigned to the $NATRIGGER property.

The following commands add the $NATRIGGER property to the sales variable, so that unsolved data will be aggregated using the sales.aggmap aggregation map:

CONSIDER sales
PROPERTY '$NATRIGGER' 'AGGREGATE(sales USING sales.aggmap)'

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 2001, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback