Operating on the Same Correlation Variable Referencing Variables That Have not Been Matched Yet
19.2 MEASURES Clause
The MEASURES clause exports makes available for inclusion in the SELECT attribute values of events that successfully match the pattern you specify. You may specify expressions over correlation variables that reference partition attributes, order by attributes, singleton variables and aggregates on group variables, and aggregates on the attributes of the stream that is the source of the MATCH_ RECOGNIZE clause. You qualify attribute values by correlation variable to export the value of the attribute for the event that matches the correlation variable’s condition. For example, within the MEASURES clause, A.c1 refers to the value of event attribute c1: ■ In the tuple that last matched the condition corresponding to correlation variable A, if A is specified in the DEFINE clause. ■ In the last processed tuple, if A is not specified in the DEFINE clause. This is because if A is not specified in the DEFINE clause, then A is considered as TRUE always. So effectively all the tuples in the input match to A. You may include in the SELECT statement only attributes you specify in the MEASURES clause. pattern_measures_clause::= non_mt_measure_list::= on page 19-9 non_mt_measure_list::= measure_column::= on page 19-9 measure_column::= 19-10 Oracle Complex Event Processing CQL Language Reference arith_expr::= on page 5-6, identifier::= on page 7-16 In Example 19–1 , the pattern_measures_clause is: MEASURES A.itemId as itemId This section describes: ■ Section 19.2.1, Functions Over Correlation Variables in the MEASURES Clause For more information, see: ■ Section 19.1.2, Referencing Singleton and Group Matches ■ Section 19.1.3, Referencing Aggregates ■ Section 19.4, DEFINE Clause ■ Section 1.1.11, Functions19.2.1 Functions Over Correlation Variables in the MEASURES Clause
In the MEASURES clause, you may apply any single-row or aggregate function to the attributes of events that match a condition. Example 19–11 applies the last function over correlation variable Z.c1 in the MEASURES clause. Example 19–11 Using Functions Over Correlation Variables query id=tkpattern_q41[CDATA[ select T.firstW, T.lastZ from tkpattern_S11 MATCH_RECOGNIZE MEASURES A.c1 as firstW, lastZ.c1 as lastZ ALL MATCHES PATTERNA W+ X+ Y+ Z+ DEFINE W as W.c2 prevW.c2, X as X.c2 prevX.c2, Y as Y.c2 prevY.c2, Z as Z.c2 prevZ.c2 as T ]]query Note the following in the MEASURES clause in Example 19–11 : ■ A.c1 will export the value of c1 in the first and only the first event that the query processes because: – A is not specified in the DEFINE clause, therefor it is always true. – A has no pattern quantifiers, therefor it will match exactly once. ■ The built-in aggregate function last will export the value of c1 in the last event that matched Z at the time the PATTERN clause was satisfied. For more information, see: ■ Section 19.1.3, Referencing Aggregates ■ Section 19.1.3.5, Using count With , identifier., and identifier.attr ■ Section 19.1.3.6, Using first and lastParts
» Oracle Fusion Middleware Online Documentation Library
» Streams and Channels Oracle CEP represents a stream as a channel as
» Channel Schema The event source you connect to a stream determines the
» Querying a Channel Once the event source, channel, and processor are
» Controlling Which Queries Output to a Downstream Channel If you specify more
» Relations Relations and Oracle CEP Tuple Kind Indicator
» Range, Rows, and Slide at Query Start-Up and for Empty Relations The descriptions
» Partition Stream-to-Relation Operators Windows
» Default Stream-to-Relation Operator Stream-to-Relation Operators Windows
» Relation-to-Relation Operators Stream-to-Stream Operators
» Event Sources Event Sources and Event Sinks
» Relational Database Table Event Sources
» Function Table Event Sources
» Pattern Recognition Cache Event Sources Functions
» Data Cartridges Fundamentals of Oracle CQL
» Lexical Conventions Oracle CQL Statements
» Oracle CQL and SQL Standards
» Oracle CEP Visualizer Oracle CEP Tools
» Oracle CQL Built-in Datatypes
» Numeric Values Datatype Comparison Rules
» Date Values Datatype Comparison Rules
» Implicit Datatype Conversion Datatype Conversion
» Explicit Datatype Conversion Datatype Conversion
» SQL Datatype Conversion Datatype Conversion
» Oracle Data Cartridge Datatype Conversion
» User-Defined Function Datatype Conversion
» Integer Literals Numeric Literals
» Floating-Point Literals Numeric Literals
» Text Literals Datetime Literals
» Number Format Models Format Models
» Aliases in the relation_variable Clause
» How to Define a Data Type Alias Using the Aliases Element
» Schema Object Naming Guidelines Schema Object Naming Examples
» ELEMENT_TIME for a System-Timestamped Stream
» Using ELEMENT_TIME With SELECT
» Using ELEMENT_TIME With GROUP BY
» Using ELEMENT_TIME With PATTERN
» What You May Need to Know About Unary and Binary Operators
» What You May Need to Know About Operator Precedence
» Comparison Conditions Oracle Fusion Middleware Online Documentation Library
» Logical Conditions Oracle Fusion Middleware Online Documentation Library
» Range Conditions Oracle Fusion Middleware Online Documentation Library
» Null Conditions Compound Conditions
» Using IN and NOT IN as a Set Operation Using IN and NOT IN as a Membership Condition
» Introduction to Common Oracle CQL DDL Clauses
» Introduction to Oracle CQL Built-In Single-Row Functions
» Built-In Aggregate Functions and the Where, Group By, and Having Clauses
» Introduction to Oracle CQLBuilt-In Single-Row Colt Functions
» double c Oracle Fusion Middleware Online Documentation Library
» Introduction to Oracle CQL Built-In java.lang.Math Functions
» User-Defined Single-Row Functions Types of User-Defined Functions
» How to Implement a User-Defined Single-Row Function
» How to Implement a User-Defined Aggregate Function
» Data Cartridge Name Data Cartridge Application Context
» Oracle CQL Data Cartridge Types
» Application Class Space Policy
» No Automatic Import Class Space Policy Server Class Space Policy
» Class Loading Example Class Loading
» Data Cartridge Name Method Resolution
» How to Query Using the Java API How to Query Using Exported Java Classes
» Data Cartridge Name Understanding Oracle Spatial
» Element Info Array Ordinates and Coordinate Systems and the SDO_SRID
» Geometric Relation Operators Scope
» com.oracle.cep.cartridge.spatial.Geometry Methods
» oracle.spatial.geometry.JGeometry Methods The following JGeometry public
» Datatype Mapping Oracle Spatial Application Context
» How to Access the Geometry Types That the Oracle Spatial Java API Supports
» How to Create a Geometry How to Access Geometry Type Public Methods and Fields
» Data Cartridge Name Understanding the Oracle CEP JDBC Data Cartridge
» Scope Understanding the Oracle CEP JDBC Data Cartridge
» Datatype Mapping Understanding the Oracle CEP JDBC Data Cartridge
» function Element Attributes Defining SQL Statements: function Element
» Multiple Parameter JDBC Cartridge Context Functions Using the Oracle CEP
» Overloading JDBC Cartridge Context Functions Using the Oracle CEP JDBC data
» Using SELECT List Aliases Using the TABLE Clause
» Using a Native CQL Type as a return-component-type
» How to Create an Oracle CQL Query
» Where Clause Query Building Blocks
» MATCH_RECOGNIZE Query Queries
» Relational Database Table Query XMLTable Query
» Function TABLE Query Queries
» Sorting Query Results Queries
» Detecting Differences in Query Results
» Parameterized Queries in Oracle CQL Statements
» The bindings Element Parameterized Queries
» Run-Time Query Naming Lexical Conventions for Parameter Values
» Views and Joins Views and Schemas
» Cache Key First and Simple Equality No Arithmetic Operations on Cache Keys
» Oracle CQL Queries and Oracle Data Cartridges
» MATCH_RECOGNIZE and the WHERE Clause Referencing Singleton and Group Matches
» Running Aggregates and Final Aggregates
» Operating on the Same Correlation Variable Referencing Variables That Have not Been Matched Yet
» Using prev Understanding Pattern Recognition With MATCH_RECOGNIZE
» Functions Over Correlation Variables in the MEASURES Clause
» Pattern Quantifiers and Regular Expressions
» Referencing One Correlation Variable From Another in the DEFINE Clause
» PARTITION BY Clause Oracle Fusion Middleware Online Documentation Library
» ORDER BY Clause ALL MATCHES Clause
» WITHIN Clause Oracle Fusion Middleware Online Documentation Library
» Fixed Duration Non-Event Detection
» Recurring Non-Event Detection DURATION Clause
» INCLUDE TIMER EVENTS Clause SUBSET Clause
» Pattern Detection MATCH_RECOGNIZE Examples
» Pattern Detection With PARTITION BY
Show more