Java examples for JDBC:Stored Procedure
Create procedure myprocinout with an IN/OUT parameter named x
import java.sql.Connection; import java.sql.Statement; public class Main { public static void main(String[] args) throws Exception{ Connection connection = null; Statement stmt = connection.createStatement(); String procedure =/*from ww w. jav a 2 s . c o m*/ "CREATE OR REPLACE PROCEDURE myprocinout(x IN OUT VARCHAR) IS " + "BEGIN " + "INSERT INTO oracle_table VALUES(x); " // Use x as IN parameter + "x := 'outvalue'; " // Use x as OUT parameter + "END;"; stmt.executeUpdate(procedure); } }