Oracle9i OLAP Services Developer's Guide to the OLAP DML
Release 1 (9.0.1)

Part Number A86720-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Working with Expressions, 13 of 14


Substitution Expressions

What is a substitution expression?

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.

Note: You cannot use ampersand substitution in model equations.

Example: Using ampersand substitution

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.

report curname
CURNAME
----------
PRODUCT

However, if you execute the following command, then REPORT produces the values of the dimension PRODUCT, as shown below.

report &curname
PRODUCT
--------------
TENTS
CANOES
RACQUETS
SPORTSWEAR
FOOTWEAR

How are substitution expressions processed?

Although ampersand substitution lets you write more 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.

Other ways to write general programs

To avoid ampersand substitution, you can use the IF or SWITCH command instead. For more information about the IF or SWITCH command, see the entry for the command in the OLAP DML Reference.

Related information

For more information, see the following table.

IF you want documentation about . . .  THEN see . . . 

IF and SWITCH commands, 

the entry for the command in the OLAP DML Reference 

writing conditional commands in the OLAP DML, 

"Controlling the Flow of Execution" 


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback