PARTITION BY Clause Oracle Fusion Middleware Online Documentation Library

Pattern Recognition With MATCH_RECOGNIZE 19-21 19000: + 13,19 19000: + 14,19 20000: + 12,20 20000: + 13,20 20000: + 14,20 21000: + 12,21 21000: + 13,21 21000: + 14,21 23000: + 16,23 23000: + 17,23 28000: + 24,28 30000: + 26,30 38000: + 33,38 38000: + 34,38 40000: + 36,40 48000: + 42,48 50000: + 45,50 50000: + 46,50 As Example 19–20 shows, the ALL MATCHES clause reports all the matched pattern instances on receiving a particular input. For example, at time 20000, all of the tuples {12,20}, {13,20}, and {14,20} are output. For more information, see Section 19.3.1, Pattern Quantifiers and Regular Expressions .

19.8 WITHIN Clause

The WITHIN clause is an optional clause that outputs a pattern_clause match if and only if the match occurs within the specified time duration. within_clause::= time_spec::= on page 7-29 That is, if and only if: TL - TF WD Where: ■ TL - Timestamp of last event matching the pattern. ■ TF - Timestamp of first event matching the pattern. ■ WD - Duration specified in the WITHIN clause. The WITHIN INCLUSIVE clause tries to match events at the boundary case as well. That is, it outputs a match if and only if: TL - TF = WD If the match completes within the specified time duration, then the event is output as soon as it happens. That is, if the match can be output, it is output with the timestamp at which it completes. The WITHIN clause does not wait for the time duration to expire as the DURATION clause does. When the WITHIN clause duration expires, it discards any potential candidate matches which are incomplete. 19-22 Oracle Complex Event Processing CQL Language Reference For more information, see Section 19.12.4, Pattern Detection With the WITHIN Clause .

19.9 DURATION Clause

The DURATION clause is an optional clause that you should use only when writing a query involving non-event detection. Non-event detection is the detection of a situation when a certain event which should have occurred in a particular time limit does not occur in that time frame. duration_clause::= time_unit::= on page 7-29 Using this clause, a match is reported only when the regular expression in the PATTERN clause is matched completely and no other event or input arrives until the duration specified in the DURATION clause expires. The duration is measured from the time of arrival of the first event in the pattern match. You must use the INCLUDE TIMER EVENTS clause when using the DURATION clause. For more information, see Section 19.10, INCLUDE TIMER EVENTS Clause . This section describes: ■ Section 19.9.1, Fixed Duration Non-Event Detection ■ Section 19.9.2, Recurring Non-Event Detection

19.9.1 Fixed Duration Non-Event Detection

The duration can be specified as a constant value, such as 10. Optionally, you may specify a time unit such as seconds or minutes see time_unit::= on page 7-29; the default time unit is seconds. Consider the query tkpattern_q59 in Example 19–21 that uses DURATION 10 to specify a delay of 10 s 10000 ms and the data stream tkpattern_S19 in Example 19–22 . Stream tkpattern_S19 has schema c1 integer. The query returns the stream in Example 19–23 . Example 19–21 MATCH_RECOGNIZE with Fixed Duration DURATION Clause Query query id=BBAQuery[CDATA[ select T.p1, T.p2 from tkpattern_S19 MATCH_RECOGNIZE MEASURES A.c1 as p1, B.c1 as p2 include timer events Note: You cannot use a WITHIN clause with a DURATION clause. For more information, see Section 19.9, DURATION Clause . Note: You cannot use a DURATION clause with a WITHIN clause. For more information, see Section 19.8, WITHIN Clause .