In all of the previous examples, the queries contain hard-coded constants, such as 30 or joe. Most typically, the actual values used in the query are unknown when the RQL statement is written. In this case, the values can be substituted with parameter expressions. For example:

age > ?0 AND firstName CONTAINS ?1 RANGE ?2+10

Every ?{number} represents a parameterized value that is supplied on query execution. How those values are supplied depends on the application performing the query. In the case of entity EJBs, where RQL queries are used to represent finder methods, the parameters are filled in from the arguments of the finder methods. For example, ?0 is substituted with the value of the first argument, ?1 with the second, and so on.

Parameter expressions can generally be used wherever constant values are used, including in RANGE expressions. However, parameter expressions can not be used in array expressions, such as ID IN or IN FOLDERS queries. Also, parameter expressions can not be used as substitutes for property names; all property names must be hard-coded into the RQL query when it is written.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices