IN Operator BETWEEN Operator

EPL Reference: Operators 3-3 integer values then the type of the array is java.lang.Integer[]. If the types returned by all expressions are a compatible number types, such as integer and double values, the engine coerces the array element values and returns a suitable type, java.lang.Double[] in this example. The type of the array returned is Object[] if the types of expressions cannot be coerced or return object values. Null values can also be used in an array definition. Arrays can come in handy for use as parameters to user-defined functions: SELECT FROM RFIDEvent RETAIN ALL WHERE Filter.myFilterzone, {1,2,3}

3.7 List and Range Operators

This section describes the following two operations: ■ Section 3.7.1, IN Operator ■ Section 3.7.2, BETWEEN Operator

3.7.1 IN Operator

The IN operator determines if a given value matches any value in a list. The syntax of the operator is: test_expression [NOT] IN expression [,expression [,…]] The test_expression is any valid expression. The IN keyword is followed by a list of expressions to test for a match. The optional NOT keyword specifies that the result of the predicate be negated. The result of an IN expression is of type Boolean. If the value of test_expression is equal to any expression from the comma-separated list, the result value is true. Otherwise, the result value is false. All expressions must be of the same type or a type compatible with test_expression. The next example shows how the IN keyword can be applied to select certain command types of RFIDEvents: SELECT FROM RFIDEvent RETAIN ALL WHERE command IN OBSERVATION, SIGNAL The statement is equivalent to: SELECT FROM RFIDEvent RETAIN ALL WHERE command = OBSERVATION OR symbol = SIGNAL

3.7.2 BETWEEN Operator

The BETWEEN operator specifies a range to test. The syntax of the operator is: test_expression [NOT] BETWEEN begin_expression AND end_expression The test_expression is any valid expression and is the expression to test for the range being inclusively within the expressions defined by begin_expression and end_expression . The NOT keyword specifies that the result of the predicate be negated. 3-4 Oracle Complex Event Processing EPL Language Reference The result of a BETWEEN expression is of type Boolean. If the value of test_ expression is greater then or equal to the value of begin_expression and less than or equal to the value of end_expression, the result is true. The next example shows how the BETWEEN keyword can be used to select events with a price between 55 and 60 inclusive. SELECT FROM StockTickEvent RETAIN ALL WHERE price BETWEEN 55 AND 60 The equivalent expression without using the BETWEEN keyword is: SELECT FROM StockTickEvent RETAIN ALL WHERE price = 55 AND price = 60 The begin_expression and end_expression may occur in either order without affecting the query. For example, the following is equivalent to the above example: SELECT FROM StockTickEvent RETAIN ALL WHERE price BETWEEN 60 AND 55

3.8 String Operators