Savepoints are very important if database applications. The code below demonstrate how to set a savepoint between statements. Then transaction is roll backed, the later statement will be removed.

Java Code:
Statement stmt = conn.createStatement();
int rows = stmt.executeUpdate("INSERT INTO TAB1 (COL1) VALUES " +
                                                    "(?FIRST?)");
// set savepoint
Savepoint svpt1 = conn.setSavepoint("SAVEPOINT_1");
rows = stmt.executeUpdate("INSERT INTO TAB1 (COL1) " +
                                           "VALUES (?SECOND?)");
...
conn.rollback(svpt1);
...
conn.commit();