Referencing One Correlation Variable From Another in the DEFINE Clause

19-20 Oracle Complex Event Processing CQL Language Reference 4000 4,6 5000 5,3 6000 6,7 7000 7,6 8000 8,2 9000 9,6 10000 10,2 11000 11,9 12000 12,9 13000 13,8 14000 14,5 15000 15,0 16000 16,9 17000 17,2 18000 18,0 19000 19,2 20000 20,3 21000 21,8 22000 22,5 23000 23,9 24000 24,9 25000 25,4 26000 26,7 27000 27,2 28000 28,8 29000 29,0 30000 30,4 31000 31,4 32000 32,7 33000 33,8 34000 34,6 35000 35,4 36000 36,5 37000 37,1 38000 38,7 39000 39,5 40000 40,8 41000 41,6 42000 42,6 43000 43,0 44000 44,6 45000 45,8 46000 46,4 47000 47,3 48000 48,8 49000 49,2 50000 50,5 51000 51,3 52000 52,3 53000 53,9 54000 54,8 55000 55,5 56000 56,5 57000 57,9 58000 58,7 59000 59,3 60000 60,3 Example 19–20 ALL MATCHES Clause Stream Output Timestamp Tuple Kind Tuple 9000: + 3,9 9000: + 4,9 11000: + 6,11 11000: + 7,11 19000: + 12,19 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.