【发布时间】:2012-11-07 05:19:55
【问题描述】:
我在我的 java 程序中使用了一个选择命令,并将它的值存储在结果集中。现在在结果集中循环时,我想使用一个选择命令,它将选择结果集的前 5 行并插入到其他表中。第二次,它应该选择接下来的 5 行并插入到表中。第三次,以此类推..
Statement s = connection.createStatement();
s.executeQuery("Select * from table1");
ResultSet res = s.getResultSet();
while(res.next()){
// here i want to select the first 5 lines of the result set and insert in the second table
}
【问题讨论】: