|Oracle9i OLAP Developer's Guide to the OLAP DML
Release 2 (9.2)
Part Number A95298-01
Working with Expressions, 10 of 11
A substitution expression allows you to substitute the value of the expression for the expression itself in a command or function.
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 the expression should be evaluated with the ampersand and substitute the resulting value before it evaluates the rest of the 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.
You cannot use ampersand substitution in model equations.
Although ampersand substitution lets you write general programs that can handle different variables and data, program lines that use ampersand substitution are executed less efficiently. Lines with ampersand substitution are not compiled; instead these lines are interpreted when the program runs. To avoid ampersand substitution, you can use the
"Controlling the Flow of Execution" for information about writing conditional commands.
Suppose you have a variable called
curname that holds the name of one of the dimensions in the analytic workspace (
product). If you execute the following command, then
REPORT produces the single value,
product, which is the actual value stored in the
curname variable, as shown below.
However, if you execute the following command, then
REPORT produces the values of the dimension
product, as shown below.