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