![]() Previous |
![]() Next |
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 to represent the expression. Oracle OLAP does not store the data for a formula in a variable; instead it calculates the data at run time each time the data 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:
To specify the expression when you first define the formula object:
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.
To specify the expression for the formula after you define the formula object:
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
You can use TRACE to help you debug a forumula.