In Oracle PL/SQL you can use the DELETE statement to delete one or more rows in a table. In Java JDBC you have to use the prepared statements:
Oracle:
-- Procedure that deletes rows from table CREATE OR REPLACE PROCEDURE sp_deleteCity(p_name VARCHAR2) AS BEGIN DELETE FROM cities WHERE name_upper = UPPER(p_name) OR name = p_name; END; /
Java:
public static void sp_deleteCity(String name) { PreparedStatement stmt = conn.prepareStatement( "DELETE FROM cities WHERE name_upper = UPPER(?) OR name = ?"); stmt.setString(1, name); stmt.setString(2, name); stmt.executeUpdate(); }
For more information, see Oracle PL/SQL to Java Migration.