我有一个下拉列表,它包含表中所有列的名称。当用户选择一个特定的列名并输入一个特定的值来搜索两个不同的日期时,我得到这些信息并更新表格,如下所示。在更新Java中的Oracle表之前获取计数
但是在更新之前,我想提示一个对话框询问用户“这多行将被更新,你想这样做吗?”。我可以修改此代码中的某些内容以在更新之前获取该计数,还是有更好的方法来执行此操作?
sql.append(" UPDATE Table_jack ");
sql.append(" set date = to_date('" + this.getNewDate() + "','MM/DD/YYYY')");
if ((this.getSelectedDDL() != null)&& (this.getSelectedDDL().equals("1"))){
sql.append(" where id_nbr =" + this.getValue() + "'");
sql.append(" and date between to_date('" + this.getDateFrom() + "','MM/DD/YYYY') and to_date('" + this.getDateTo() + "','MM/DD/YYYY')");
}
if ((this.getSelectedDDL() != null)&& (this.getSelectedDDL().equals("2"))){
sql.append(" where name =" + this.getValue() + "'");
sql.append(" and date between to_date('" + this.getDateFrom() + "','MM/DD/YYYY') and to_date('" + this.getDateTo() + "','MM/DD/YYYY')");
}
ResultSet rset = db.executeQuery(sql.toString(),true);