Statement stmt = null;
ResultSet rs = null;
con = SimpleServlet.axaptaCP.getConnection();
stmt = con.createStatement();
int tag = 0 ;
boolean label = true;
stmt.execute("{call " + SimpleServlet.axaptaCP.elbaseDB + ".dbo.el_mp_pc_report_view( '" +no + "')}");
while(label){
int i = 0;
i = stmt.getUpdateCount();
boolean up_label = false;
if(i != -1){
up_label = stmt.getMoreResults();
continue;
}
boolean flag_label =false;
rs=stmt.getResultSet();
if(rs !=null){
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
tag++;
if(tag == 1){
while(rs.next()){
}
}else if(tag ==2){
while(rs.next()){
for(int j = 0 ;j<columnCount; j++){
System.out.println("結果集二"+rs.getString(j+1));
}
}
}else if (tag ==3){
//coding
}
flag_label = stmt.getMoreResults();
continue;
}
label = up_label ||flag_label;
}
(java) 处理多个结果集
最新推荐文章于 2021-06-05 12:46:04 发布