Create a function named myfunc which returns a VARCHAR value; the function has no parameter - Java JDBC

Java examples for JDBC:Stored Procedure

Description

Create a function named myfunc which returns a VARCHAR value; the function has no parameter

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 =//w ww  .  j  av a2  s .c o  m
        "CREATE OR REPLACE FUNCTION myfunc RETURN VARCHAR IS "
        + "BEGIN "
        + "RETURN 'a returned string'; "
        + "END;";
    stmt.executeUpdate(function);

  }
}

Related Tutorials