First page Back Continue Last page Text

oracle adf workshop

Notes:


Changing View Object WHERE or ORDER BY Clause at Run Time

You can change the WHERE and ORDER BY clauses of a query at run time by calling setWhereClause() or setOrderByClause() on the view object. Although setWhereClause() is the easiest way to change a view object’s query, it often is not the most efficient. If you can, you should use parameterized WHERE clauses or structured WHERE clauses.

To change the WHERE clause of a query at run time, perform the following steps:

1. Create a String containing the new WHERE clause. Do not include the word WHERE. If you want to remove the WHERE clause entirely, use null. For example, either of the following could be appropriate definitions:

String whereClause = "ORDER_TOTAL > 500";

String whereClause = null;

2. Pass this string into setWhereClause(). For example, if OrdVO is a variable containing the view object instance to be changed, you would call: ordVO.setWhereClause(whereClause);

3. If there is an existing design-time WHERE clause, using setWhereClause() adds to it, further restricting the query results.