There are some situations where a complete SQL statement is not known until run time. For example, the predicates in a WHERE clause might depend on search criteria that a user specifies. In such cases, when you call a method in a Data object, you substitute a String variable for the SQL statement.
For example, suppose that you want your application to allow users to specify criteria for querying a table that maintains records about projects in your department. You could use code that is similar to the following example code:
String columnList = ...
String searchPred = ...
String SQLstmt = "SELECT " + columnList + " FROM DEPT_SCHEMA.PROJ WHERE " + searchPred;
Iterator<Employee> empReport = db.queryIterator(SQLstmt, Employee.class);
Remember, however, that when you construct SQL statements at run time, pureQuery cannot check the syntax of the statements before run time. You also cannot take advantage of the performance of static SQL, if you are using a DB2® database.