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
This section describes the following string operators:
■
Section 3.8.1, LIKE Operator
■
Section 3.8.2, REGEXP Operator
3.8.1 LIKE Operator
The LIKE operator provides standard SQL pattern matching. SQL pattern matching allows you to use _ to match any single character and to match an arbitrary number
of characters including zero characters. In EPL, SQL patterns are case-sensitive by default. The syntax of LIKE is:
test_expression [NOT] LIKE pattern_expression [ESCAPE string_literal] The test_expression is any valid expression yielding a String type or a numeric
result. The optional NOT keyword specifies that the result of the predicate be negated. The LIKE keyword is followed by any valid standard SQL pattern_expression
yielding a String-typed result. The optional ESCAPE keyword signals the escape character used to escape the _ and values in the pattern.
The result of a LIKE expression is of type Boolean. If the value of test_ expression
matches the pattern_expression, the result value is true. Otherwise, the result value is false. An example for the LIKE keyword is shown
below. SELECT
FROM PersonLocationEvent RETAIN ALL WHERE name LIKE Jack
In this example the WHERE clause matches events where the suffix property is a single _ character.
SELECT FROM PersonLocationEvent RETAIN ALL
WHERE suffix LIKE _ ESCAPE
EPL Reference: Operators 3-5
3.8.2 REGEXP Operator
The REGEXP operator is a form of pattern matching based on regular expressions implemented through the Java java.util.regex package. The syntax of REGEXP is:
test_expression [NOT] REGEXP pattern_expression The test_expression is any valid expression yielding a String type or a numeric
result. The optional NOT keyword specifies that the result of the predicate be negated. The REGEXP keyword is followed by any valid regular expression pattern_
expression yielding a String-typed result.
The result of a REGEXP expression is of type Boolean. If the value of test_ expression
matches the regular expression pattern_expression, the result value is true. Otherwise, the result value is false.
An example for the REGEXP operator is below. SELECT
FROM PersonLocationEvent RETAIN ALL WHERE name REGEXP Jack
3.9 Temporal Operators