OutgoingResultSet is an interface for constructing an outgoing result set by adding rows as List<Object>.

The methods in this interface are:

Method Description
addColumn(String name) Specify the name of the next column for this results set. The names for all the columns should be specified before addRow is called, unless the default names are desired. Default column names will be used for any columns that have not been named by calling this method: "c1", "c2", etc.
addRow(List<Object> row) Add a row to this result set, to be sent to the ResultCollector. The column descriptions should be added with addColumn before this method is called, otherwise default column descriptions will be inferred based on the first row added with columns named "c1", "c2", etc.
endResults() Invoke this method to let the result set know that there are no more rows to be added.


--The procedure retrieveDynamicResultsWithOutgoingResultSet a stored
--procedure which returns 0, 1, 2, 3 or 4 ResultSet.

public static void retrieveDynamicResultsWithOutgoingResultSet(int number,
          ResultSet[] rs1, ResultSet[] rs2, ResultSet[] rs3,
          ResultSet[] rs4, ProcedureExecutionContext pec) 
          throws SQLException {

      Connection c = pec.getConnection();

      if (number > 0) {
        rs1[0] = c.createStatement().executeQuery("VALUES(1)");
      if (number > 1) {
        OutgoingResultSet ors=pec.getOutgoingResultSet(2);
        for(int i=0; i<10; ++i) {
          List<Object> row=new ArrayList<Object>();
          row.add(new Integer(i));
          row.add("String"+ i);        
      if (number > 2) {
        rs3[0] = c.createStatement().executeQuery("VALUES(1)");
      if (number > 3) {
        rs4[0] = c.createStatement().executeQuery("VALUES(1)");