Create a function named myfuncin which returns a VARCHAR value - Java JDBC

Java examples for JDBC:Stored Procedure

Description

Create a function named myfuncin which returns a VARCHAR value

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 function =//from www .j a v  a 2 s .c  om
        "CREATE OR REPLACE FUNCTION myfuncout(x OUT VARCHAR) RETURN VARCHAR IS "
        + "BEGIN "
        + "x:= 'outvalue'; "
        + "RETURN 'a returned string'; "
        + "END;";
    stmt.executeUpdate(function);
  }
}

Related Tutorials