2-24 Oracle Complex Event Processing EPL Language Reference
params id=nasORCLNASDAQ,ORCLparams params id=nyJPMNYSE,JPMparams
params id=nyWFCNYSE,WFCparams binding
bindings processor
n1:config In the preceding example, the MarketRule EPL query includes two placeholders: one
in the SELECT clause and another in the WHERE clause. The binding id=MarketRule element specifies the list of parameter sets that will be passed to
MarketRule at runtime. Each parameter set is specified with a single params element. Because there are two placeholders in the parameterized query, each
params element specifies two values separated by a comma.
At runtime, the preceding parameterized query effectively breaks down into the following three queries
SELECT symbol, AVGprice AS average, NASDAQ AS market FROM StockTick t RETAIN ALL EVENTS
WHERE symbol = ORCL SELECT symbol, AVGprice AS average, NYSE AS market
FROM StockTick t RETAIN ALL EVENTS WHERE symbol = JPM
SELECT symbol, AVGprice AS average, NYSE AS market FROM StockTick t RETAIN ALL EVENTS
WHERE symbol = WFC
2.13.3 Programmatically Using a Prepared EPL Statement
If you use the Oracle CEP APIs in your application to create and execute EPL rules, and you want to use parameterized rules, use the
com.bea.wlevs.ede.api.PreparedStatement interface to create instances of the com.bea.wlevs.ede.api.BoundStatement interfaced based on provided
parameter values.
Both PreparedStatement and BoundStatement extend Statement, which is the basic object that represents a compiled EPL query. PreparedStatement has
additional methods to bind parameters to the placeholders in the query, return the number of placeholders in the query, and return an instance of the BoundStatement
based on a binding id. BoundStatement has additional methods for getting the parameter values used to bind the EPL query and getting the actual parameterized
query itself.
If you call the start or stop methods on a PreparedStatement, Oracle CEP starts or stops all of the BoundStatements that have been created from the
PreparedStatement; this is because a parameterized query is not itself executable, only the BoundStatements that have been created from it with specific parameter
values are actually executable.
See Oracle Fusion Middleware Java API Reference for Oracle Complex Event Processing for the full reference documentation on these APIs.
The following sample Java snippet shows how to create a BoundStatement using the query described in
Section 2.13.1, General Usage :
String stmtString = select symbol, avgprice as average, ? as market +
from StockTick t + retain all events +
where symbol = ? ;
EPL Reference: Clauses 2-25
processorImpl.createStatementstmtString; PreparedStatement preparedStmt =
PreparedStatementprocessorImpl.createStatementstmtString; BoundStatement orclBoundStmt = preparedStmt.bindnew String[]
{NASDAQ,ORCL};
2-26 Oracle Complex Event Processing EPL Language Reference
3
EPL Reference: Operators 3-1
3
EPL Reference: Operators
This section contains information on the following subjects:
■
Section 3.1, Overview of EPL Operators