Previous
Previous
 
Next
Next

Boolean Expressions

A Boolean expression is a logical statement that is either TRUE or FALSE. Boolean expressions can compare data of any type if both parts of the expression have the same basic data type. You can test data to see if it is equal to, greater than, or less than other data.

A Boolean expression can consist of Boolean data, such as the following:

For example, assume that your code contains the following Boolean expression.

   actual GT 20000

When processing this expression, Oracle OLAP compares each value of the variable actual to the constant 20,000. When the value is greater than 20,000, then the statement is TRUE; when the value is less than or equal to 20,000, then the statement is FALSE.

When you are supplying a Boolean value, you can type either YES, ON, or TRUE for a true value, and NO, OFF, or FALSE for a false value. When the result of a Boolean calculation is produced, the defaults are YES and NO in the language specified by the NLS_LANGUAGE option. The read-only YESSPELL and NOSPELL options record the YES and NO values.

Table: Comparison and Logical Operators shows the comparison and logical operators. Each operator has a priority that determines its order of evaluation. Operators of equal priority are evaluated left to right, unless parentheses change the order of evaluation. However, the evaluation is halted when the truth value is decided. For example, in the following expression, the TOTAL function is never executed because the first phrase determines that the whole expression is true.

      yes EQ yes OR TOTAL(sales) GT 20000