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.
Ensure that the Java method is declared as public and static in a public class.
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.
In the method, first create an instance of java.sql.ResultSet and then assign it to one of the ResultSet parameters.
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 procedures).
Discuss this page in DocCommentXchange.
|Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0|