Oracle9i OLAP Developer's Guide to the OLAP DML Release 2 (9.2) Part Number A95298-01 |
|
Aggregating Data, 8 of 12
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
If you want to calculate some data on the fly, you need to perform the following steps:
PRECOMPUTE
keyword in one or more RELATION
or MODEL
commands. It may also contain a CACHE
command if the default value is not appropriate.AGGREGATE
command with the aggregation map to pre-calculate the data that will be stored on disk.AGGREGATE
command, as explained in "How to Compile an Aggregation Map".$NATRIGGER
property to the variables that use the aggregation map, so that NAs in queried data will cause the AGGREGATE
function 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.
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)'
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|