Oracle9i OLAP Services Developer's Guide to the OLAP DML Release 1 (9.0.1) Part Number A86720-01 |
|
Working with Expressions, 5 of 14
Expressions represent data values in the grammar of the OLAP DML language. You can use expressions as arguments in commands or functions and as values for OLAP DML options. An expression often performs a mathematical or logical operation. It always evaluates to a result in one of the OLAP DML data types.
An expression can be:
10
or 'EAST'
)
INFLATION*1.02
or ACTUAL GT 20000
)
An expression has a data type. It can also have dimensions. The data type and dimensions of an expression depend on the values you are using in the expression.
The data type of an expression can be one of the following basic types:
These data types are defined in "OLAP DML Data Types".
The data type of an expression is the data type of the resulting value. It may not be the same as the data type of the OLAP DML data objects that make up the expression; it depends on the data and on the operators and functions that are involved.
In addition, a conditional expression that is indicated by an IF. . .THEN. . .ELSE operator is supported. A conditional expression returns a value whose data type depends on the expressions in the THEN and ELSE clauses, not on the expression in the IF clause, which must be Boolean.
Note: Do not confuse a conditional expression with the IF command, which has similar syntax but a different purpose. The IF command does not have a data type and is not evaluated like an expression.
You can use the CONVERT function to change an expression's data type. For example, you can convert a number to text, or you can convert a text string that consists of digits to a number.
However, there is no need to convert data to another type within the same basic category because those conversions are made automatically. In general, you can use TEXT or ID data anywhere text is called for, and you can use integers and decimal numbers interchangeably.
OLAP DML data types are discussed in "OLAP DML Data Types".
You can save an expression in a formula. Typically, you define a formula to save complex or frequently used expressions. A formula is a OLAP DML object that you name and define using the DEFINE FORMULA command.
For example, you can define a formula to calculate dollar sales, as follows.
define dollar.sales formula units * price
Each time you use a formula, the expression it represents is evaluated.
For more information, see the following table.
IF you want documentation about . . . | THEN see . . . |
---|---|
functions, |
the OLAP DML Reference |
formulas, |
the entry for the DEFINE FORMULA command in the OLAP DML Reference |
dimension status and limiting dimensions, |
the entry for the LIMIT command in the OLAP DML Reference |
assigning permissions to dimension values, |
"Adding Security to an Analytic Workspace" the entry for the PERMIT command in the OLAP DML Reference |
user-defined functions, |
|
qualified data references, |
"Specifying a Single Value for the Dimension of an Expression" |
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|