|Oracle9i OLAP Developer's Guide to the OLAP DML
Release 2 (9.2)
Part Number A95298-01
Aggregating Data, 8 of 12
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
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
If you want to calculate some data on the fly, you need to perform the following steps:
PRECOMPUTEkeyword in one or more
MODELcommands. It may also contain a
CACHEcommand if the default value is not appropriate.
AGGREGATEcommand with the aggregation map to pre-calculate the data that will be stored on disk.
AGGREGATEcommand, as explained in "How to Compile an Aggregation Map".
$NATRIGGERproperty to the variables that use the aggregation map, so that NAs in queried data will cause the
AGGREGATEfunction to execute.
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.
$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
The following commands add the
$NATRIGGER property to the
sales variable, so that unsolved data will be aggregated using the
sales.aggmap aggregation map: