Procedure Implementation

The example result processor supports this procedure implementation. The procedure uses a single result set and no OUT parameters.

package examples;

import com.vmware.sqlfire.*;
import java.sql.*;

public class MergeSortProcedure {
  
  static final String LOCAL = "<local>";
  
  public static void mergeSort(ResultSet[] outResults,
                               ProcedureExecutionContext context)
  throws SQLException {
    
    String queryString = LOCAL
                         + "SELECT * FROM "
                         + context.getTableName();      
    Connection cxn = context.getConnection();
    Statement stmt = cxn.createStatement();
    ResultSet rs = stmt.executeQuery(queryString);
    outResults[0] = rs;
    // Do not close the connection since this would also
    // close the result set.
  }

}