function Element Attributes Defining SQL Statements: function Element

17-10 Oracle Complex Event Processing CQL Language Reference Example 17–8 shows an Oracle CEP JDBC data cartridge application context that defines an JDBC cartridge context function that takes two input parameters. Example 17–8 Oracle JDBC Data Cartridge Context Functions With Multiple Parameters ... 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 ...

17.2.1.3.2 Invoking PLSQL Functions Using the Oracle CEP JDBC data cartridge, you

can define JDBC cartridge context functions that invoke PLSQL functions that the database defines. Example 17–9 shows an Oracle CEP JDBC data cartridge application context that defines a JDBC cartridge context function that invokes PLSQL function getOrderAmt. Example 17–9 Oracle JDBC Data Cartridge Context Function Invoking PLSQL Functions ... function name=getOrderAmount param name=inpId type=int return-component-type com.oracle.cep.example.jdbc_cartridge.RetEvent return-component-type sql[CDATA[ SELECT getOrderAmt:inpId as orderAmt FROM dual ]]sql function ...

17.2.1.3.3 Complex JDBC Cartridge Context Functions Using the Oracle CEP JDBC data

cartridge, you can define arbitrarily complex JDBC cartridge context functions including subqueries, aggregation, GROUP BY, ORDER BY, and HAVING. Example 17–10 shows an Oracle CEP JDBC data cartridge application context that defines a complex JDBC cartridge context function. Example 17–10 Oracle CEP JDBC Data Cartridge Complex JDBC Cartridge Context Function ... function name=getHighValueOrdersPerEmp param name=limit type=int Oracle CEP JDBC Data Cartridge 17-11 param name=inpName type=char return-component-type com.oracle.cep.example.jdbc_cartridge.RetEvent return-component-type sql[CDATA[ select description as description, sumamt as totalamt, count as numTimes from OrderDetails where orderid in select orderid from PlacedOrders where empid in select empid from Employee where empName = :inpName group by description having sumamt :limit ]]sql function ...

17.2.1.3.4 Overloading JDBC Cartridge Context Functions Using the Oracle CEP JDBC data

cartridge, you can define JDBC cartridge context functions with the same name in the same application context provided that each function has a unique signature. Example 17–11 shows an Oracle CEP JDBC data cartridge application context that defines two JDBC cartridge context functions named getDetails. Each function is distinguished by a unique signature. Example 17–11 Oracle JDBC Data Cartridge Context Function Overloading jc:jdbc-ctx nameJdbcCartridgeOnename data-sourceStockDSdata-source function name=getDetails 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 ORDER BY —SQL query using ORDER BY -- description desc ]]sql function function name=getDetails param name=inpOrderId type=int 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 PlacedOrders.orderId = :inpOrderId ]]sql