Create procedure myprocout with an OUT parameter named x - Java JDBC

Java examples for JDBC:Stored Procedure

Description

Create procedure myprocout with an OUT parameter named x

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 =/* www .  java 2s  .  co  m*/
        "CREATE OR REPLACE PROCEDURE myprocout(x OUT VARCHAR) IS "
        + "BEGIN "
        + "INSERT INTO oracle_table VALUES('string 2'); "
        + "x := 'outvalue'; " // Assign a value to x
        + "END;";
    stmt.executeUpdate(procedure);

  }
}

Related Tutorials