Link to home
Start Free TrialLog in
Avatar of eldoz12
eldoz12

asked on

how to handle return values for update sql

Hello experts ,
I call sp which updates a some tables , they return a single row with value 0 if the update is successful ,
The problem is that my program crashes whenever it receives the row back on the update statement ,

Plz advice on how to handel return values on update statments

error log
java.sql.SQLException: JZ0P1: Unexpected result type. Query:
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

>>my program crashes whenever it receives the row back on the update statement ,

Please post full exception stack trace + code
Avatar of eldoz12
eldoz12

ASKER

Below is the code i use for update       


public void approveFiling(Integer recordId) throws DAOException, ResourceException  {
            this.setIgnoreWarnings(true);
        String sql="exec spApprove " + recordId;
                  Object[] args = null;
                   this.updateThrowsDAOException(conn,sql,args);      
      }
 public int updateThrowsDAOException(Connection conn, String sql, Object[] params)
        throws DAOException, ResourceException {

        PreparedStatement stmt = null;
        int rows = 0;

        try {
            stmt = this.prepareStatement(conn, sql);
            this.fillStatement(stmt, params);
          if(timeoutInSec < Integer.MAX_VALUE )
                  stmt.setQueryTimeout(timeoutInSec);
          if(maxRows < Integer.MAX_VALUE)
                  stmt.setFetchSize(maxRows);

            rows = stmt.executeUpdate();
          SQLWarning warn = stmt.getWarnings();
          throwExceptionOnWarningIfNotIgnoringWarnings(warn);

        } catch (SQLException e) {
            this.createDAOException(e, sql, params);
        } finally {
            close(stmt);
        }

        return rows;
    }
You  didn't post the full stack trace
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial