jdbc 调用存储过程并返回值

  CallableStatement cstmt = null;
  cstmt = conn.prepareCall("call bat_active_alert(?,?,?)");
  cstmt.setString(1,comp_code);
  cstmt.setString(2,func_code);
  cstmt.registerOutParameter(3, java.sql.Types.INTEGER);//pintSuccess_cnt
  cstmt.execute();
  int rec_cnt=0;
  rec_cnt=cstmt.getInt(3);

你可能感兴趣的:(jdbc,存储)