询第"+(r+1)+"批数据"); String sql = "SELECT * FROM (SELECT rownum rn, a.dpt_code, a.arr_code,a.dpt_date,a.airways,a.flight," + "a.cabin,a.price FROM trip_special_flight a" + " where a.dpt_date >= to_date('"+nowDate+"','yyyy-mm-dd') " + "and a.dpt_date <= to_date('"+lastDate+"','yyyy-mm-dd') order by rownum asc) WHERE rn > "+lastrow; stat.setMaxRows(onerun); stat.setFetchSize(1000); rs = stat.executeQuery(sql); String text = ""; int i = 1; while (rs.next()) { text += rs.getString(2)+"|"+rs.getString(3)+"|"+rs.getDate(4)+"|"+rs.getString(5)+"|"+
rs.getString(6)+"|"+rs.getString(7)+"|"+rs.getString(8)+"||"; if(i%1000==0){ FileUtil.appendToFile(Config.tempdatafile, text); text = ""; } i++; } if(text.length()>10){ FileUtil.appendToFile(Config.tempdatafile, text); } lastrow+=onerun; } } } catch (Exception e) { e.printStackTrace(); } finally { closeAll(rs, stat, conn); } }-----java一次性
查询几十万,几百万数据解决办法&nbs