4-2 Oracle Complex Event Processing EPL Language Reference
You may also create user-defined single-row functions. See Section 4.3, User-Defined
functions .
4.1.1 The MIN and MAX Functions
The MIN and MAX functions take two or more expression parameters. The MIN function returns the lowest numeric value among these comma-separated expressions, while
the MAX function returns the highest numeric value. The return type is the compatible aggregated type of all return values.
The next example shows the MAX function that has a Double return type and returns the value 1.1.
SELECT MAX1, 1.1, 2 0.5 FROM ...
COALESCE
expression, expression [, expression
[,…] Returns the first non-null value in the
list, or null if there are no non-null values.
Section 4.1.2, The COALESCE Function
CASE
value WHEN compare_value THEN
result [WHEN compare_value THEN
result …] [ELSE result]
END Returns result where the first value
equals compare_value. Section 4.1.3, The CASE
Control Flow Function
CASE
value WHEN condition THEN
result [WHEN condition THEN
result …] [ELSE result]
END Returns the result for the first condition
that is true. Section 4.1.3, The CASE
Control Flow Function
PREV
expression, event_ property
Returns a property value of a previous event, relative to the event order within
a data window. Section 4.1.4, The PREV
Function
PRIOR
integer, event_ property
Returns a property value of a prior event, relative to the natural order of
arrival of events Section 4.1.5, The PRIOR
Function SELECT
CASE WHEN INSTANCEOFitem,
com.mycompany.Service THEN serviceName?
WHEN INSTANCEOFitem, com.mycompany.Product THEN
productName? END
FROM OrderEvent Returns a boolean value indicating
whether the type of value returned by the expression is one of the given types
Section 4.1.6, The INSTANCEOF Function
SELECT CASTitem.price?, double FROM OrderEvent
Casts the return type of an expression to a designated type.
Section 4.1.7, The CAST Function
SELECT EXISTS
item.serviceName? FROM OrderEvent
Returns a boolean value indicating whether the dynamic property,
provided as a parameter to the function, exists on the event.
Section 4.1.8, The EXISTS Function
Table 4–1 Cont. Built-In Single-Row Functions
Single-row Function Result
See
EPL Reference: Functions 4-3
The MIN function returns the lowest value. The statement below uses the function to determine the smaller of two timestamp values.
SELECT symbol, MINticks.timestamp, news.timestamp AS minT FROM StockTickEvent AS ticks, NewsEvent AS news RETAIN 30 SECONDS
WHERE ticks.symbol = news.symbol
The MIN and MAX functions are also available as aggregate functions. See Section 4.2,
Aggregate functions for a description of this usage.
4.1.2 The COALESCE Function