How to Create an Oracle CQL Query
18.2.1 Query Building Blocks
This section summarizes the basic building blocks that you use to construct an Oracle CQL query, including: ■ Section 18.2.1.1, Select, From, Where Block ■ Section 18.2.1.2, Select Clause ■ Section 18.2.1.3, From Clause ■ Section 18.2.1.4, Where Clause ■ Section 18.2.1.5, Group By Clause ■ Section 18.2.1.6, Order By Clause ■ Section 18.2.1.7, Having Clause ■ Section 18.2.1.8, Binary Clause ■ Section 18.2.1.9, IDStream Clause18.2.1.1 Select, From, Where Block
Use the sfw_block to specify the select, from, and optional where clauses of your Oracle CQL query. sfw_block::= The sfw_block is made up of the following parts: Oracle CQL Queries, Views, and Joins 18-7 ■ Section 18.2.1.2, Select Clause ■ Section 18.2.1.3, From Clause ■ Section 18.2.1.4, Where Clause ■ Section 18.2.1.5, Group By Clause ■ Section 18.2.1.6, Order By Clause ■ Section 18.2.1.7, Having Clause18.2.1.2 Select Clause
Use this clause to specify the stream elements you want in the query’s result set. The select_clause may specify all stream elements using the operator or a list of one or more stream elements. select_clause::= The list of expressions that appears after the SELECT keyword and before the from_ clause is called the select list. Within the select list, you specify one or more stream elements in the set of elements you want Oracle CEP to return from one or more streams or views. The number of stream elements, and their datatype and length, are determined by the elements of the select list. Optionally, specify distinct if you want Oracle CEP to return only one copy of each set of duplicate tuples selected. Duplicate tuples are those with matching values for each expression in the select list. For more information, see select_clause::= on page 20-318.2.1.3 From Clause
Use this clause to specify the streams and views that provide the stream elements you specify in the select_clause see Section 18.2.1.2, Select Clause . The from_clause may specify one or more comma-delimited relation_variable clauses. from_clause::= For more information, see from_clause::= on page 20-3 18-8 Oracle Complex Event Processing CQL Language Reference relation_variable::= You can select from any of the data sources that your relation_variable clause specifies. You can use the relation_variable clause AS operator to define an alias to label the immediately preceding expression in the select list so that you can reference the result by that see Section 2.8.1.1, Aliases in the relation_variable Clause . If you create a join see Section 18.4, Joins between two or more streams, view, or relations that have some stream element names in common, then you must qualify stream element names with the name of their stream, view, or relation. Example 18–2 shows how to use stream names to distinguish between the customerID stream element in the OrderStream and the customerID stream element in the CustomerStream. Example 18–2 Fully Qualified Stream Element Names query id=q0[CDATA[ select from OrderStream, CustomerStream where OrderStream.customerID = CustomerStream.customerID ]]query Otherwise, fully qualified stream element names are optional. However, Oracle recommends that you always qualify stream element references explicitly. Oracle CEP often does less work with fully qualified stream element names. For more information, see: ■ Section 18.2.4, MATCH_RECOGNIZE Query ■ Section 18.2.6, XMLTable Query ■ Section 18.2.7, Function TABLE Query ■ relation_variable::= on page 20-418.2.1.4 Where Clause
Use this optional clause to specify conditions that determine when the select_ clause returns results see Section 18.2.1.2, Select Clause . Because Oracle CQL applies the WHERE clause before GROUP BY or HAVING, if you specify an aggregate function in the SELECT clause, you must test the aggregate function result in a HAVING clause, not the WHERE clause. For more information, see: ■ opt_where_clause::= on page 20-4 ■ Section 9.1.1, Built-In Aggregate Functions and the Where, Group By, and Having Clauses Oracle CQL Queries, Views, and Joins 18-9Parts
» 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