Returning result sets from Java methods

This section describes how to make result sets available from Java methods. You must write a Java method that returns a result set to the calling environment, and wrap this method in a SQL stored procedure declared to be EXTERNAL NAME of LANGUAGE JAVA.

 Return result sets from a Java method
  1. Ensure that the Java method is declared as public and static in a public class.

  2. For each result set you expect the method to return, ensure that the method has a parameter of type java.sql.ResultSet[]. These result set parameters must all occur at the end of the parameter list.

  3. In the method, first create an instance of java.sql.ResultSet and then assign it to one of the ResultSet[] parameters.

  4. Create a SQL stored procedure of type EXTERNAL NAME LANGUAGE JAVA. This type of procedure is a wrapper around a Java method. You can use a cursor on the SQL procedure result set in the same way as any other procedure that returns result sets.

    For more information about the syntax for stored procedures that are wrappers for Java methods, see CREATE PROCEDURE statement [External call].

 Example
 See also