Using SELECT List Aliases Using the TABLE Clause

Oracle CEP JDBC Data Cartridge 17-15 return employeeName.length; } } This class provides helper methods, like getEmployeeNameLength, that you can invoke within the Oracle CQL query. For more information, see: ■ Section 17.2.1.2.2, return-component-type ■ Section 18.2.7, Function TABLE Query ■ table_clause on page 20-10

17.2.2.3 Using a Native CQL Type as a return-component-type

Following is a JDBC cartridge context that defines a function that has a native CQL type bigint as return-component-type. Example 17–16 CQL Type bigint as a return-component-type jc:jdbc-ctx nameJdbcCartridgeOnename data-sourcemyJdbcDataSourcedata-source function name=getOrderAmt param name=inpId type=int return-component-typebigintreturn-component-type -- native CQL as return component type -- sql[CDATA[ SELECT getOrderAmt:inpId as orderAmt FROM select :inpId as iid from dual]] sql function jc:jdbc-ctx Example 17–17 shows how the getOrderAmt function in Example 17–16 can be used in a CQL query. Example 17–17 getOrderAmt Function in a CQL Query query id=q1[CDATA[ RStream select currentOrder.orderId, details.orderInfo as orderAmt from OrderArrival[now] as currentOrder, TABLEgetOrderAmtJdbcCartridgeTwocurrentOrder.orderId as orderInfo of bigint as details ]]query Note that the alias orderInfo itself is of type bigint and can be accessed as details.orderInfo as orderAmt in the select list of the CQL query. The of bigint clause used inside the TABLE construct is optional. If specified, the type mentioned should match the return-component-type, which is bigint in Example 17–16 . 17-16 Oracle Complex Event Processing CQL Language Reference Part IV Part IV Using Oracle CQL This part contains the following chapters: ■ Chapter 18, Oracle CQL Queries, Views, and Joins ■ Chapter 19, Pattern Recognition With MATCH_RECOGNIZE ■ Chapter 20, Oracle CQL Statements 18 Oracle CQL Queries, Views, and Joins 18-1 18 Oracle CQL Queries, Views, and Joins You select, process, and filter element data from streams and relations using Oracle CQL queries and views. A top-level SELECT statement that you create using the QUERY statement is called a query . A top-level VIEW statement that you create using the VIEW statement is called a view the Oracle CQL equivalent of a subquery. A join is a query that combines rows from two or more streams, views, or relations. This chapter describes: ■ Section 18.1, Introduction to Oracle CQL Queries, Views, and Joins ■ Section 18.2, Queries ■ Section 18.3, Views ■ Section 18.4, Joins ■ Section 18.5, Oracle CQL Queries and the Oracle CEP Server Cache ■ Section 18.6, Oracle CQL Queries and Relational Database Tables ■ Section 18.7, Oracle CQL Queries and Oracle Data Cartridges For more information, see: ■ Section 1.2.1, Lexical Conventions ■ Section 1.2.3, Documentation Conventions ■ Chapter 2, Basic Elements of Oracle CQL ■ Chapter 7, Common Oracle CQL DDL Clauses ■ Chapter 20, Oracle CQL Statements

18.1 Introduction to Oracle CQL Queries, Views, and Joins

An Oracle CQL query is an operation that you express in Oracle CQL syntax and execute on an Oracle CEP CQL Processor to process data from one or more streams or views. For more information, see Section 18.2, Queries . An Oracle CQL view represents an alternative selection on a stream or relation. In Oracle CQL, you use a view instead of a subquery. For more information, see Section 18.3, Views . Oracle CEP performs a join whenever multiple streams appear in the FROM clause of the query. For more information, see Section 18.4, Joins .