Skip Headers

Oracle® OLAP DML Reference
10g Release 1 (10.1)

Part Number B10339-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

3.8 Substitution Expressions

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:

  1. Evaluate the expression following the ampersand (the substitution expression).

  2. 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.

You cannot use ampersand substitution in model equations.


Note:

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 often use the IF or SWITCH command instead.

Example 3-3 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