Create procedure myproc with no parameters - Java JDBC

Java examples for JDBC:Stored Procedure

Description

Create procedure myproc with no parameters

Demo Code

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 w  ww . j  a  v  a  2s . c om*/
        "CREATE OR REPLACE PROCEDURE myproc IS "
        + "BEGIN "
        + "INSERT INTO oracle_table VALUES('string 1'); "
        + "END;";
    stmt.executeUpdate(procedure);
  }
}

Related Tutorials