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

Part Number A95298-01
 Home Book List Contents Index Master Index Feedback

Allocating Data, 2 of 5

Introduction to Allocation

The Oracle OLAP `ALLOCATE` command distributes data from a source object to the cells of a target. The target is a variable that is dimensioned by one or more hierarchical dimensions. The source data is specified by dimension values at a higher level in a hierarchical dimension than the values that specify the target cells.

`ALLOCATE` uses an aggregation map to specify the dimensions and the values of the hierarchies to use in the allocation, the method of operation to use for a dimension, and other aspects of the allocation.

Some of the allocation operations are based on existing data. The object containing that data is the basis object for the allocation. In those operations, `ALLOCATE` distributes the data from the source based on the values of the basis object.

Forecasting and budgeting systems often use allocation in operations such as the automatic distribution of a bonus pool with the amounts based on the current salary and performance ratings of the employee.

An allocation is the opposite of an aggregation that you perform with the `AGGREGATE` command. In an aggregation, the data at lower levels of a hierarchy is combined into data at higher levels. In an allocation, data at a higher level in the hierarchy is distributed to lower levels.

The `ALLOCATE` command has operations that are the inverse of the operations of the `AGGREGATE` command. Figure 9-1 shows an aggregation up a simple hierarchy. In a `SUM` operation, the aggregation adds the detail level values 2, 3, and 4 to derive the value 9 at the aggregate level.

Figure 9-1 Aggregation in a Simple Hierarchy

Text description of the illustration simpagg.gif

As an example of an allocation, you could take the aggregate value 9, double it to 18, and allocate the results to the detail level with the previous values of the detail level cells as the basis of the allocation. In Figure 9-2 the hierarchy on the left shows the result of an `EVEN` allocation operation, in which the source value is distributed evenly. Each detail level cell receives a value of 6. The hierarchy on the right shows a `PROPORTIONAL` allocation operation, in which the source value is distributed proportionately. The values allocated to the detail level are 4, 6 and 8.

Figure 9-2 Allocation in a Simple Hierarchy

Text description of the illustration simpallc.gif

The allocation operation methods range from simple allocations, such as copying the source data to the cells of the target variable, to very complex allocations, such as a proportional distribution of data from a source that is a formula, with the amount distributed being based on another formula, with multiple variables as targets, and with an aggregation map that specifies different methods of allocation for different dimensions.

The Oracle OLAP allocation system is very flexible and has many features, including the following:

• The source, basis, and target objects can be the same variable or they can be different objects.
• The source and basis objects can be formulas, so you can perform computations on existing data and use the result as the source or basis of the allocation.
• You can specify the method of operation of the allocation for a dimension. The operations range from simple to very complex. The operations of the allocation system are the inverse of the aggregation operations.
• You can specify whether the allocated value is added to or replaces the existing value of the target cell.
• You can specify an amount to add to or multiply by the allocated value before the result is assigned to the target cell.
• You can lock individual values in a dimension hierarchy so that the data of the target cells for those dimension values is not changed by the allocation. If you lock a dimension value, then the allocation system normalizes the source data, which subtracts the locked data from the source before the allocation. You can choose to not normalize the source data.
• You can specify minimum, maximum, floor, or ceiling values for certain operations.
• You can copy the allocated data to a second variable so that you can have a record of individual allocations to a cell that is the target of multiple allocations.
• You can specify ways of handling allocations when the basis has a null value.
• You can use the same aggregation map in different `ALLOCATE` commands to use the same set of dimension hierarchy values, operations, and arguments with different source, basis, or target objects.

Along with the `ALLOCATE` command, the OLAP DML contains other commands that support allocation. Table 9-1 lists those commands.

Table 9-1
Command Description

`AGGMAPINFO` command

Returns information about the contents of an aggregation map object, such as the type of the aggregation map, which indicates whether it contains commands for aggregation or allocation.

`ALLOCATE` command

Allocates data from a source object to a target variable.

`ALLOCERRLOGFORMAT` command

Determines the contents and the formatting for the error log that you specify with the `ERRORLOG` argument to the `ALLOCATE` command.

`ALLOCERRLOGHEADER` command

Determines the column headings for the error log.

`ALLOCMAP` command

Adds contents to an aggmap object that specify the path of the allocation down a dimension hierarchy, the method of operation, and other aspects of the allocation. Marks the object as an `ALLOCMAP` type aggregation map.

`POUTFILEUNIT` option

Identifies a location that receives information on the progress of an `ALLOCATE` command.

The remainder of this chapter describes the objects that you use to allocate data and the types of allocation operations, and provides examples of various allocations.