Pattern Detection With PARTITION BY

Pattern Recognition With MATCH_RECOGNIZE 19-33 As Table 19–3 shows for the queryWithinInclusive query, the candidate match starts with the event at TimeStamp=1000. When the query receives the event at TimeStamp=4000, that event is included in the match because the query uses WITHIN INCLUSIVE and the event matches B. Note that although the event at TimeStamp=5000 matches B, the pattern is not grown further since it exceeds the duration 3 seconds measured from the start of the match TimeStamp=1000. Since this match ends at TimeStamp=4000 and we are not using ALL MATCHES, the next match does not start at TimeStamp=4000, even though it matches A. For more information, see: ■ Section 19.8, WITHIN Clause ■ Section 19.7, ALL MATCHES Clause

19.12.5 Fixed Duration Non-Event Detection

Consider an object that moves among five different rooms. Each time it starts from room 1, it must reach room 5 within 5 minutes. Figure 19–3 shows the object’s performance. This data can be represented as a stream of time and room number. Note that when the object started from room 1 at time 1, it reached room 5 at time 5, as expected. However, when the object started from room 1 at time 6, it failed to reach room 5 at time 11; it reached room 5 at time 12. When the object started from room 1 at time 15, it was in room 5 at time 20, as expected. However, when the object started from room 1 at time 23, it failed to reach room 5 at time 28; it reached room 5 at time 30. The successes at times 5 and 20 are considered events: the arrival of the object in room 5 at the appropriate time. The failures at time 11 and 28 are considered non-events: the expected arrival event did not occur. Using Oracle CQL, you can query for such non-events. Figure 19–3 Fixed Duration Non-Event Detection Example 19–38 shows query q on stream S with schema c1 integer representing room number that detects these non-events. Each time the object fails to reach room 5 within 5 minutes of leaving room 1, the query returns the time of departure from room 1. 19-34 Oracle Complex Event Processing CQL Language Reference Example 19–38 Fixed Duration Non-Event Detection: Query query id=q[CDATA[ select T.Atime FROM S MATCH_RECOGNIZE MEASURES A.ELEMENT_TIME as Atime INCLUDE TIMER EVENTS PATTERN A B DURATION 5 MINUTES DEFINE A as A.c1 = 1, B as B.c1 = 5 as T ]]query For more information, see Section 19.9, DURATION Clause . 20 Oracle CQL Statements 20-1 20 Oracle CQL Statements This chapter describes the various Oracle CQL data definition language DDL and data modification language DML statements that Oracle CEP supports.

20.1 Introduction to Oracle CQL Statements

Oracle CQL supports the following DDL statements: ■ Query ■ View For more information, see: ■ Section 1.2.1, Lexical Conventions ■ Section 1.2.2, Syntactic Shortcuts and Defaults ■ Section 1.2.3, Documentation Conventions ■ Chapter 2, Basic Elements of Oracle CQL ■ Chapter 7, Common Oracle CQL DDL Clauses ■ Chapter 18, Oracle CQL Queries, Views, and Joins Note: In stream input examples, lines beginning with h such as h 3800 are heartbeat input tuples. These inform Oracle CEP that no further input will have a timestamp lesser than the heartbeat value.