Select Clause From Clause

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] 18-12 Oracle Complex Event Processing CQL Language Reference group by orderId ]]query For more information, see: ■ Section 1.1.5, Stream-to-Stream Operators ■ xmltable_clause::= on page 20-6 ■ SQLXML SQLX on page 5-16

18.2.7 Function TABLE Query

Use the TABLE clause to access the multiple rows returned by a built-in or user-defined function in the FROM clause of an Oracle CQL query. The TABLE clause converts the set of returned rows into an Oracle CQL relation. Because this is an external relation, you must join the TABLE function clause with a stream. table_clause::= object_expr::= on page 5-19, identifier::= on page 7-16, datatype::= on page 2-2 Note the following: ■ The function must return an array type or Collection type. ■ You must join the TABLE function clause with a stream. Example 18–7 shows a data cartridge TABLE clause that invokes the Oracle Spatial method getContainingGeometries, passing in one parameter InputPoints.point. The return value of this method, a Collection, is aliased as validGeometries. The relation that the TABLE clause returns is aliased as R2. Example 18–7 Data Cartridge TABLE Query query id=q1[CDATA[ RSTREAM SELECT R2.validGeometries.shape as containingGeometry, R1.point as inputPoint FROM InputPoints[now] as R1, TABLE getContainingGeometriesspatial InputPoints.point as validGeometries AS R2 ]]query Example 18–8 shows an invalid data cartridge TABLE query that fails to join the data cartridge TABLE clause with another stream because the function getAllGeometriesspatial was called without any parameters. Oracle CEP invokes the data cartridge method only on the arrival of elements on the joined stream. Example 18–8 Invalid Data Cartridge TABLE Query query id=q2[CDATA[ RSTREAM SELECT R2.validGeometries.shape as containingGeometry FROM