Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

18.3.9 Receiving a dynamic result set

To receive a dynamic result set by invoking a procedure that returns a dynamic result set, use the getNextResultSet() method for the execution context. For the native interface version, a procedure that returns a dynamic result set cannot be used because JDBC result sets cannot be used.

The getNextResultSet() method returns a dynamic result set (ResultSet object) as a return value. Every time this method is invoked, it returns the next result set. After it returns the last result set, it returns a null value.

For a procedure or SQL statement that does not return a dynamic result set, a null value is returned. A null value is returned also when SQL execution is not normally terminated.

If an error occurs during the execution of the getNextResultSet() method, the SQLException occurs.

An example follows:

#sql  [execCtx] { CALL MULTI_RESULTS() };
 ResultSet rs;
 while((rs == execCtx.getNextResultSet() ) != null){
   processing-of-the-retrieval-result;
   rs.close();
 }