Using Database Operations

Collaboration usability for a stored procedure ResultSet

The Column data of the ResultSets can be dragged-and-dropped from their XSC nodes to the Business Rules. Below is a code snippet that can be generated by the Collaboration Editor:


while (getSPIn().getSpS_multi().resultsAvailable())
{
if (getSPIn().getSpS_multi().getUpdateCount() > 0)
  {
    System.err.println("Updated "+getSPIn().getSpS_multi().getUpdateCount()+" rows");
  }

  if (getSPIn().getSpS_multi().getNormRS().available())
  {
    while (getSPIn().getSpS_multi().getNormRS().next())
    {
      System.err.println("Customer Id   = "+getSPIn().
getSpS_multi().getNormRS().getCustomerId());
      System.err.println("Customer Name = "+getSPIn().
getSpS_multi().getNormRS().getCustomerName());
      System.err.println();
    }
    System.err.println("===");
  }
  else if (getSPIn().getSpS_multi().getDbEmployee().available())
  {
    while (getSPIn().getSpS_multi().getDbEmployee().next())
    {
      System.err.println("EMPNO    = "+getSPIn().
getSpS_multi().getDbEmployee().getEMPNO());
      System.err.println("ENAME    = "+getSPIn().
getSpS_multi().getDbEmployee().getENAME());
      System.err.println("JOB      = "+getSPIn().
getSpS_multi().getDbEmployee().getJOB());
      System.err.println("MGR      = "+getSPIn().
getSpS_multi().getDbEmployee().getMGR());
      System.err.println("HIREDATE = "+getSPIn().
getSpS_multi().getDbEmployee().getHIREDATE());
      System.err.println("SAL      = "+getSPIn().
getSpS_multi().getDbEmployee().getSAL());
      System.err.println("COMM     = "+getSPIn().
getSpS_multi().getDbEmployee().getCOMM());
      System.err.println("DEPTNO   = "+getSPIn().
getSpS_multi().getDbEmployee().getDEPTNO());
      System.err.println();
    }
    System.err.println("===");
  }
}

Note –

resultsAvailable() and available() cannot be indiscriminately called because each time they move ResultSet pointers to the appropriate locations.


After calling "resultsAvailable()", the next result (if available) can be either a ResultSet or an UpdateCount if the default "enableResultSetsAndUpdateCount()" was used.

Because of limitations imposed by some DBMSs, it is recommended that for maximum portability, all of the results in a ResultSet object should be retrieved before OUT parameters are retrieved. Therefore, you should retrieve all ResultSet(s) and Update Counts first followed by retrieving the OUT type parameters and return values.

The following list includes specific ResultSet behavior that you may encounter:

The DBWizard Assistant expects the column names to be in English when creating a ResultSet.