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.
Perform the following tasks to return result sets from a Java method:
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 call].
Discuss this page in DocCommentXchange.
|Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0|