Oracle® OLAP DML Reference 11g Release 1 (11.1) Part Number B28126-01 |
|
|
View PDF |
The AGGMAP ADD or REMOVE model command adds or removes a previously-defined model from a previously-defined aggregation specification (that is, aggmap object of type AGGMAP). Models are used in aggregation specifications to aggregate data over a non-hierarchical dimension (such as line items), which has no parent relation and therefore cannot be aggregated by a RELATION statement. See MODEL (in an aggregation) for details.
Note:
Although you can use the AGGMAP ADD MODEL and AGGMAP REMOVE MODEL statements to temporarily add a model to an aggmap object, typically you use a MAINTAIN ADD SESSION statement like the one below to perform this action.MAINTAIN dimension ADD SESSION member = model APPLY TO AGGMAP aggmap
When you use a MAINTAIN ADD SESSION statement neither the calculated member or its definition persists from session to session; both are deleted at the end of the session in which they are created
Syntax
AGGMAP {ADD model TO aggmap|REMOVE model FROM aggmap}
Arguments
Temporarily adds a model to an aggmap object. The model is attached to the aggmap only for the duration of the session. Even when the analytic workspace has been updated and committed, the model is discarded from the aggmap when the session is closed.
Removes a model from an aggmap.
The name of the model object that you wish to add to the specified aggmap.
The name of a previously defined aggmap object of type AGGMAP.
Examples
Example 9-24 Temporarily Adding a Model to an Aggmap
Assume for example, that you have an aggmap object named letter.aggmap
with the following definition.
DEFINE LETTER.AGGMAP AGGMAP AGGMAP RELATION letter.letter PRECOMPUTE ('AA') END
Assume also that you want to create summarized variable data for the cells that are dimensioned by the dimension values AAB
and ABA
. However, you do not want this data to be permanently stored in the analytic workspace. You just want to see the data during your session.
To perform this type of aggregation, you can take the following steps:
Create a dimension value for the custom aggregate. This dimension value will be the parent of the dimension values AAB
and ABA
. The following statement adds 'BB
' to the letter
dimension.
MAINTAIN letter ADD 'BB'
Create a MODEL
object that contains an AGGREGATION
function, which associates child dimension values with the new dimension value. The following model identifies BB
as the parent of AAB
and ABA
. Note that the parent dimension value (in this case, BB) cannot already be defined as a parent in the parent relation (letter.letter
).
DEFINE LETTER.MODEL MODEL MODEL DIMENSION letter BB=AGGREGATION('AAB' 'ABA')
Execute an AGGMAP ADD
statement to append the model to the existing AGGMAP
object.
AGGMAP ADD letter.model TO letter.aggmap
The aggmap now looks like this.
DEFINE LETTER.AGGMAP AGGMAP AGGMAP RELATION letter.letter PRECOMPUTE ('AA') END AGGMAP ADD letter.model
The model is executed only by the AGGREGATE
function like the one shown here; the AGGREGATE
command ignores it.
REPORT AGGREGATE(units USING letter.aggmap)
When you wish to remove the model from the aggmap during a session, use the AGGMAP REMOVE
statement.
To ensure that your aggmap does not become a permanent object in the analytic workspace, before you close your session issue the following statement to delete the dimension values that you added in Step 1.
MAINTAIN letter DELETE 'BB'
When your session ends, Oracle OLAP automatically removes the model added using the AGGMAP ADD statement. You do not have to issue an explicit AGGMAP REMOVE statement.