You can use the results-set return facility by specifying 1 or a greater value in the DYNAMIC RESULT SETS clause in CREATE PROCEDURE during Java stored procedure definition. The results-set return facility is not supported for Java stored functions.
The results-set return facility enables the Java stored procedure caller to reference the cursor that is acquired by the execution of the SELECT statement within the Java stored procedure.
Figure 9-11 shows an overview of the results-set return facility.
Figure 9-11 Overview of the results-set return facility (for a Java stored procedure)
The calling-source languages that support the results-set return facility are as follows:
This example obtains columns rank, name, and age, which satisfy condition rank<10 in tables emps_1 and emps_2 within a Java stored procedure. The caller receives two result sets to manipulate them.
CREATE PROCEDURE proc2(IN param1 INTEGER) ...........1 |
import java.sql.*; ..................................1 |
import java.sql.*; ................................1 |
Specify the retrieval result (ResultSet) in the OUT parameter of the ResultSet[] type without closing it.