Sorting Query Results Queries

Oracle CQL Queries, Views, and Joins 18-17 The binding element must contain one or more params elements. Each params element must have a unique id and must contain a comma separated list of parameter values equal in number to the number of placeholder characters :n in the corresponding query. The order of the parameter values corresponds to placeholder characters :n in the parameterized query, such that :1 corresponds to the first parameter value, :2 corresponds to the second parameter value, and so on. You may use placeholder characters :n in any order. That is, :1 corresponds to the first parameter value whether it precedes or follows :2 in a query. A placeholder number can be used only once in a query. For more information, see: ■ Section 18.2.11.4, Lexical Conventions for Parameter Values ■ Section 18.2.11.5, Parameterized Queries at Runtime

18.2.11.3 Run-Time Query Naming

When a binding instantiates a parameterized query, Oracle CEP creates a new query at run time with the name queryId_paramId. For example, in Example 18–11 , the run-time name of the first query instantiated by the MarketRule binding is MarketRule_nasORCL. To avoid run-time naming conflicts, be sure query ID and parameter ID combinations are unique.

18.2.11.4 Lexical Conventions for Parameter Values

Each params element must have a unique id and must contain a comma separated list of parameter values equal in number to the number of placeholder characters :n in the corresponding query. In an Oracle CQL query, a placeholder within single or double quotes is a String literal. The following query is not a parameterized query: SELECT :1 as symbol, price FROM StockTick [RANGE 5 SECONDS] Oracle CEP parses this query as assigning the String literal :1 to alias symbol. To make this query into a parameterized query, use: SELECT :1 as symbol, price FROM StockTick [RANGE :2 SECONDS] And define a params element like this: params id=p1ORCL, 5params Table 18–2 Parameterized Query Parameter Value Lexical Conventions Convention Example Replacement Value Primitive type literals params id=p1NASDAQ, 200.0params :1 = NASDAQ :2 = 200.0 Oracle CQL fragments params id=p1count, avgvalparams :1 = count :2 = avgval Quotes params id=p1’alert’, Seattle, WA, ’fun’ || house, one two 3params :1 = ’alert’ :2 = Seattle, WA :3 = ’fun’ || house :4 = one two 3