Parameterized Queries in Oracle CQL Statements

18-20 Oracle Complex Event Processing CQL Language Reference correlationId, 1 as priority from MAXBIDMINASK as bba, filteredStream[rows 1] as p where bba.cusip = p.cusip ]]query Using this technique, you can achieve the same results as in the subquery case. However, using views you can better control the complexity of queries and reuse views by name in other queries.

18.3.1 Views and Joins

If you create a join between two or more views that have some stream element names in common, then you must qualify stream element names with names of streams. Example 18–14 shows how to use view names to distinguish between the seq stream element in the BIDMAX view and the seq stream element in the ASKMIN view. Example 18–14 Using View Names to Distinguish Between Stream Elements of the Same Name view id=MAXBIDMINASK schema=cusip bidseq bidSrcId bid askseq askSrcId ask bidQty askQty[CDATA[ select bid.cusip, bid.seq, bid.srcId as bidSrcId, bid.bid, ask.seq, ask.srcId as askSrcId, ask.ask, bid.bidQty, ask.askQty from BIDMAX as bid, ASKMIN as ask where bid.cusip = ask.cusip ]]view Otherwise, fully qualified stream element names are optional. However, it is a best practice to always qualify stream element references explicitly. Oracle CEP often does less work with fully qualified stream element names. For more information, see Section 18.4, Joins .

18.3.2 Views and Schemas

You may define the optional schema of the view using a space delimited list of event attribute names as Example 18–15 shows. Example 18–15 Schema With Event Attribute Names Only view id=MAXBIDMINASK schema=cusip bidseq[CDATA[ select ... ]]view

18.4 Joins

A join is a query that combines rows from two or more streams, views, or relations. Oracle CEP performs a join whenever multiple streams appear in the FROM clause of the query. The select list of the query can select any stream elements from any of these streams. If any two of these streams have a stream element name in common, then you must qualify all references to these stream elements throughout the query with stream names to avoid ambiguity. If you create a join between two or more streams, view, or relations that have some stream element names in common, then you must qualify stream element names with the name of their stream, view, or relation. Example 18–16 shows how to use stream names to distinguish between the customerID stream element in the OrderStream stream and the customerID stream element in the CustomerStream stream.