Oracle CQL Built-in Datatypes
2.2.2 Handling Other Datatypes Using Oracle CQL Data Cartridges
If your event uses a datatype that Oracle CQL does not support, you can use an Oracle CQL data cartridge to evaluate that datatype in an Oracle CQL query. Oracle CQL includes the following data cartridges: ■ Chapter 15, Oracle Java Data Cartridge ■ Chapter 16, Oracle Spatial ■ Chapter 17, Oracle CEP JDBC Data Cartridge For more information, see Chapter 14, Introduction to Data Cartridges .2.2.3 Handling Other Datatypes Using a User-Defined Function
If your event uses a datatype that Oracle CQL does not support, you can create a user-defined function to evaluate that datatype in an Oracle CQL query. Consider the enum datatype that Example 2–1 shows. The event that Example 2–2 shows uses this enum datatype. Oracle CQL does not support enum datatypes. Example 2–1 Enum Datatype ProcessStatus package com.oracle.app; public enum ProcessStatus { CHAR[size] 1 Variable-length character data of length size characters. Maximum size is 4096 characters. Default and minimum size is 1 character. For more information, see Section 2.4.1, Text Literals . DOUBLE Fixed-length number equivalent to a Java double type. For more information, see Section 2.4.2, Numeric Literals . FLOAT Fixed-length number equivalent to a Java float type. For more information, see Section 2.4.2, Numeric Literals . INTEGER Fixed-length number equivalent to a Java int type. For more information, see Section 2.4.2, Numeric Literals . INTERVAL Fixed-length INTERVAL datatype specifies a period of time. Oracle CEP supports DAY TO SECOND. Maximum length is 64 bytes. For more information, see Section 2.4.4, Interval Literals . TIMESTAMP Fixed-length TIMESTAMP datatype stores a datetime literal that conforms to one of the java.text.SimpleDateFormat format models that Oracle CQL supports. Maximum length is 64 bytes. For more information, see Section 2.4.3, Datetime Literals . XMLTYPE Use this datatype for stream elements that contain XML data. Maximum length is 4096 characters. XMLTYPE is a system-defined type, so you can use it as an argument of a function or as the datatype of a stream attribute. For more information, see SQLXML SQLX on page 5-16. OBJECT This stands for any Java object that is, any subclass of java.lang.Object. We refer to this as opaque type support in Oracle CEP since the Oracle CEP engine does not understand the contents of an OBJECT field. You typically use this type to pass values, from an adapter to its destination, as-is; these values need not be interpreted by the Oracle CEP engine such as Collection types or any other user-specific Java type but that are associated with the event whose other fields are referenced in a query. 1 Oracle CQL supports single-dimension arrays only. Table 2–1 Cont. Oracle CQL Built-in Datatype Summary Oracle CQL Datatype Description 2-4 Oracle Complex Event Processing CQL Language Reference OPEN1, CLOSED0} } Example 2–2 Event Using Enum Datatype ProcessStatus package com.oracle.app; import com.oracle.capp.ProcessStatus; public class ServiceOrder { private String serviceOrderId; private String electronicSerialNumber; private ProcessStatus status; ... } By creating the user-defined function that Example 2–3 shows and registering the function in your application assembly file as Example 2–4 shows, you can evaluate this enum datatype in an Oracle CQL query as Example 2–5 shows. Example 2–3 User-Defined Function to Evaluate Enum Datatype package com.oracle.app; import com.oracle.capp.ProcessStatus; public class CheckIfStatusClosed { public boolean executeObject[] args { ProcessStatus arg0 = ProcessStatusargs[0]; if arg0 == ProcessStatus.OPEN return Boolean.FALSE; else return Boolean.TRUE; } } Example 2–4 Registering the User-Defined Function in Application Assembly File wlevs:processor id=testProcessor wlevs:listener ref=providerCache wlevs:listener ref=outputCache wlevs:cache-source ref=testCache wlevs:function function-name=statusClosed exec-method=”execute” bean class=com.oracle.app.CheckIfStatusClosed wlevs:function wlevs:processor Example 2–5 Using the User-Defined Function to Evaluate Enum Datatype in an Oracle CQL Query query id=rule-04[CDATA[ SELECT meter.electronicSerialNumber, meter.exceptionKind FROM MeterLogEvent AS meter, ServiceOrder AS svco WHERE meter.electronicSerialNumber = svco.electronicSerialNumber and svco.serviceOrderId IS NULL OR statusClosedsvco.status ]]query For more information, see Chapter 13, User-Defined Functions .Parts
» 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