java连接oracle之删除:java连接oracle之后又该怎么删除数据库的中的内容呢?希望下面的文章对大家有所帮助。
class deleteByTerms { int index = 1; String sql = null; public boolean toChoose(Connection con, int chose, String var) { switch(chose) { case 1: sql = "delete from worker_main where worker_id = ?"; break; case 2: sql = "delete from worker_main where worker_name = ?"; break; } int tag = delete(con, sql, index, var); if (tag > 0) return true; else return false; } private static int delete(Connection con, String sql, int index, String var) { int result = 0; PreparedStatement pre = null; try { pre = con.prepareStatement(sql); pre.setString(index, var); result = pre.executeUpdate(); } catch (SQLException e) { System.out.println("delete"); e.printStackTrace(); } return result; } }