In Oracle PL/SQL you can use the INSERT statement to insert rows into a table. In Java JDBC you have to use the prepared statements:
Oracle:
-- Procedure that inserts a row into table CREATE OR REPLACE PROCEDURE sp_insertCity(name VARCHAR2) AS BEGIN INSERT INTO cities VALUES (name, UPPER(name)); END; /
Java:
public static void sp_insertCity(String name) { PreparedStatement stmt = conn.prepareStatement("INSERT INTO cities VALUES (?, UPPER(?))"); stmt.setString(1, name); stmt.setString(2, name); stmt.executeUpdate(); }
For more information, see Oracle PL/SQL to Java Migration.