Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B10339-02 |
|
|
View PDF |
The ACROSS command specifies a text expression that contains one or more statements to be executed in a loop. The repetition of these statements is controlled by the status of the dimensions and composites specified in the ACROSS command.
Syntax
ACROSS dimension... DO dml-statements
Arguments
One or more dimensions or composites whose current status controls the repetition of one or more statements, which are contained in dml-statements. The statements are repeated for each combination of the values of the specified dimensions in the current status. When two or more dimensions are specified, the first one varies the slowest.
A multiline text expression that is one or more OLAP DML statements to be executed for each iteration of the loop.
Notes
You cannot specify statements in the text expression of ACROSS that are typically used as part of a multiple-line construct in a program. For example, the IF...THEN...ELSE, WHILE, FOR, or SWITCH statements cannot be executed by the ACROSS command.
The compiled code for the loop body will not be generated until the ACROSS command or the program that contains it is executed. This allows for the possibility that, because the statements are contained within a text expression, the contents of an ACROSS loop may change between compilation and execution.
ACROSS temporarily sets status to the values that are in current status for the specified dimensions. After the ACROSS statement executes, dimension status is restored to what it was before the loop, and execution of the program resumes with the next statement.
Examples
Example 6-13 Repeating ROW Commands
In a report program, you want to show the unit sales of tents for each of three months. Use the following ACROSS command to repeat ROW commands for each value of the month
dimension.
LIMIT product TO 'Tents' LIMIT month TO 'Jan95' to 'Mar95' ACROSS month DO 'ROW INDENT 5 month WIDTH 6 unit' Jan95 533363 Feb95 572796 Mar95 707198