Select, From, Where Block

18-10 Oracle Complex Event Processing CQL Language Reference ■ UNION and UNION ALL ■ IN and NOT IN For more information, see binary::= on page 20-6.

18.2.1.9 IDStream Clause

Use this clause to take either a select-from-where clause or binary clause and return its results as one of IStream or DStream relation-to-stream operators. You can succinctly detect differences in query output by combining an IStream or Dstream operator with the using_clause. For more information, see: ■ idstream_clause::= on page 20-6 ■ IStream Relation-to-Stream Operator on page 4-24 ■ DStream Relation-to-Stream Operator on page 4-25 ■ Section 18.2.10, Detecting Differences in Query Results

18.2.2 Simple Query

Example 18–3 shows a simple query that selects all stream elements from a single stream. Example 18–3 Simple Query query id=q0[CDATA[ select from OrderStream where orderAmount 10000.0 ]]query For more information, see Query on page 20-2.

18.2.3 Built-In Window Query

Example 18–4 shows a query that selects all stream elements from stream S2, with schema c1 integer, c2 float, using a built-in tuple-based stream-to-relation window operator. Example 18–4 Built-In Window Query query id=BBAQuery[CDATA[ select from S2 [range 5 minutes] where S2.c1 10 ]]query For more information, see: ■ Section 1.1.3, Stream-to-Relation Operators Windows ■ window_type::= on page 20-4

18.2.4 MATCH_RECOGNIZE Query

Example 18–5 shows a query that uses the MATCH_RECOGNIZE clause to express complex relationships among the stream elements of ItemTempStream. Example 18–5 MATCH_RECOGNIZE Query query id=detectPerish[CDATA[ select its.itemId Oracle CQL Queries, Views, and Joins 18-11 from tkrfid_ItemTempStream MATCH_RECOGNIZE PARTITION BY itemId MEASURES A.itemId as itemId PATTERN A B C DEFINE A AS A.temp = 25, B AS B.temp = 25 and to_timestampB.element_time - to_timestampA.element_time INTERVAL 0 00:00:05.00 DAY TO SECOND, C AS to_timestampC.element_time - to_timestampA.element_time = INTERVAL 0 00:00:05.00 DAY TO SECOND as its ]]query For more information, see: ■ Chapter 19, Pattern Recognition With MATCH_RECOGNIZE ■ pattern_recognition_clause::= on page 19-1

18.2.5 Relational Database Table Query

Using an Oracle CQL processor, you can specify a relational database table as an event source. You can query this event source, join it with other event sources, and so on. For more information, see, Section 18.6, Oracle CQL Queries and Relational Database Tables

18.2.6 XMLTable Query

Example 18–6 shows a view v1 and a query q1 on that view. The view selects from a stream S1 of xmltype stream elements. The view v1 uses the XMLTABLE clause to parse data from the xmltype stream elements using XPath expressions. Note that the data types in the view’s schema match the datatypes of the parsed data in the COLUMNS clause. The query q1 selects from this view as it would from any other data source. The XMLTABLE clause also supports XML namespaces. Example 18–6 XMLTABLE Query view id=v1 schema=orderId LastShares LastPrice[CDATA[ select X.OrderId, X.LastShares, X.LastPrice from S1 XMLTABLE FILL PASSING BY VALUE S1.c1 as . COLUMNS OrderId char16 PATH fn:data..ID, LastShares integer PATH fn:dataLastShares, LastPrice float PATH fn:dataLastPx as X ]]view query id=q1[CDATA[ IStream select orderId, sumLastShares LastPrice, sumLastShares LastPrice sumLastShares from v1[now]