Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-02 |
|
|
View PDF |
To construct a substitution expression, use an ampersand character (&
) at the beginning of an expression. Using an ampersand (that is, the substitution operator) this way is also called ampersand substitution. The ampersand specifies that Oracle OLAP should evaluate an expression containing a substitution expression as follows:
Evaluate the expression following the ampersand (the substitution expression).
Evaluate the rest of the expression using the result of step 1 (that is, the result of the substitution expression).
Ampersand substitution gives you a level of indirection when you are specifying an expression. For example, when you specify an ampersand followed by a variable that holds the name of another variable, the value of the expression becomes the data in the second variable. Ampersand substitution lets you write more general programs that can operate on data that is chosen when the program is run. Note, however, that, Oracle OLAP does not compile program lines with ampersand substitution; instead these lines are interpreted when the program runs. To avoid ampersand substitution in a program, you can often use an IF or SWITCH command instead.
You cannot use ampersand substitution in model equations.
Example 3-4 Using Ampersand Substitution
Suppose you have a variable called curname
that holds the name of one of the dimensions in the analytic workspace (product
). When you execute the following statement, then REPORT produces the single value, product
, which is the actual value stored in the curname
variable.
REPORT curname CURNAME ---------- PRODUCT
However, when you execute the following statement, then REPORT produces the values of the dimension product
.
REPORT &curname PRODUCT -------------- Tents Canoes Racquets Sportswear Footwear