Oracle® OLAP DML Reference 10g Release 2 (10.2) Part Number B14346-01 |
|
|
View PDF |
You can save an expression in a formula. Frequently, you define a formula for ease of use and to save storage space. Once you have defined a formula for an expression, you can use the name of the formula takes the place of the text of the expression. Oracle OLAP does not store the data for a formula in a variable; instead it is calculated at runtime each time it is requested.
Before you create a formula, decide whether you want to specify the expression when you first define the formula object or whether you want to specify the expression for the formula after you define the formula object:
When you decide to specify the expression when you first define the formula object, then:
Issue a DEFINE FORMULA statement to define the formula object. Include the expression in the definition. Do not specify values for the datatype
or dimensions
arguments.
(Optional) Issue a COMPILE statement to compile the formula.
When you want the formula to be a permanent part of the analytic workspace, save the formula using an UPDATE statement followed by COMMIT.
When you decide to specify the expression for the formula after you define the formula object, then:
Issue a DEFINE FORMULA statement to define the formula object. Specify values for the datatype
or dimensions
arguments, but do not specify a value for the expression, itself.
Issue a CONSIDER statement to make the formula the current definition and, then, issue an EQ statement to specify the expression for the formula.
(Optional) Issue a COMPILE statement to compile the formula.
When you want the formula to be a permanent part of the analytic workspace, save the formula using an UPDATE statement followed by COMMIT.
For example, you can define a formula to calculate dollar sales, as follows.
DEFINE dollar.sales FORMULA units * price