Invoking PLSQL Functions Using the Oracle CEP JDBC data cartridge, you Complex JDBC Cartridge Context Functions Using the Oracle CEP JDBC data

Oracle CEP JDBC Data Cartridge 17-13 nameJdbcCartridgeOnename data-sourceStockDSdata-source function name=getDetailsByOrderIdName param name=inpOrderId type=int param name=inpName type=char return-component-type com.oracle.cep.example.jdbc_cartridge.RetEvent return-component-type sql[CDATA[ SELECT Employee.empName as employeeName, Employee.empEmail as employeeEmail, OrderDetails.description as description FROM PlacedOrders, OrderDetails , Employee WHERE PlacedOrders.empId = Employee.empId AND PlacedOrders.orderId = OrderDetails.orderId AND Employee.empName = :inpName AND PlacedOrders.orderId = :inpOrderId ]]sql function jc:jdbc-ctx ... The Oracle CQL query in Example 17–14 invokes the JDBC cartridge context function that Example 17–13 defines. Example 17–14 Oracle CQL Query Invoking an Oracle CEP JDBC Data Cartridge Context Function processor nameProcname rules query id=q1[CDATA[ RStream select currentOrder.orderId, details.orderInfo.employeeName, details.orderInfo.employeeemail, details.orderInfo.description details.orderInfo.getEmployeeNameLength from OrderArrival[now] as currentOrder, TABLEgetDetailsByOrderIdNameJdbcCartridgeOne currentOrder.orderId, currentOrder.empName as orderInfo as details ]]query rules processor You must wrap the Oracle CEP JDBC data cartridge context function invocation in an Oracle CQL query TABLE clause. You access the result set using: TABLE_CLAUSE_ALIAS .JDBC_CARTRIDGE_FUNCTION_ALIAS.SQL_SELECT_LIST_ALIAS or TABLE_CLAUSE_ALIAS .JDBC_CARTRIDGE_FUNCTION_ALIAS.METHOD_NAME Where: ■ TABLE_CLAUSE_ALIAS : the outer AS alias of the TABLE clause. 17-14 Oracle Complex Event Processing CQL Language Reference In Example 17–14 , details. ■ JDBC_CARTRIDGE_FUNCTION_ALIAS : the inner AS alias of the JDBC cartridge context function. In Example 17–14 , oderInfo. ■ SQL_SELECT_LIST_ALIAS : the JDBC cartridge context function SELECT list alias. In Example 17–13 , employeeName, employeeEmail, and description. ■ METHOD_NAME : the name of the method that the return-component-type class provides. In Example 17–14 , getEmployeeNameLength. As Example 17–14 shows, you access the JDBC cartridge context function result set in the Oracle CQL query using: details.orderInfo.employeeName details.orderInfo.employeeemail details.orderInfo.description details.orderInfo.getEmployeeNameLength The component type of the collection type returned by the JDBC data cartridge function is defined by the function element return-component-type child element. Because the function is always called from within an Oracle CQL TABLE clause, it always returns a collection type. If the getDetailsByORderIdName JDBC cartridge context function called in Example 17–14 is defined as Example 17–13 shows, then orderInfo is of type com.oracle.cep.example.jdbc_ cartridge.RetEvent. You can access both fields and methods of the return-component-type in an Oracle CQL query. In Example 17–13 , the return-component-type specifies a Java bean implemented as Example 17–15 shows. Example 17–15 Example return-component-type Class package com.oracle.cep.example.jdbc_cartridge; public class RetEvent { String employeeName; String employeeEmail; String description; Default constructor is mandatory public RetEvent1 {} May contain getters and setters for the fields public String getEmployeeName { return this.employeeName; } public void setEmployeeNameString employeeName { this.employeeName = employeeName; } ... May contain other helper methods public int getEmployeeNameLength {