Return a procedure result set to applications: the RESULT clause and DhSQLResultSet
- Last Updated: February 11, 2026
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
Return a procedure result set to applications: the RESULT clause and DhSQLResultSet
The get_sal procedure in the previous example
with a CREATE PROCEDURE uses the SQLCursor.getValue method
to store the values of a database record in individual variables.
The procedure did not, however, do anything with those values and
they will be overwritten in the next iteration of the loop that
fetches records.
The DhSQLResultSet class provides a way for
a procedure to store rows of data in a procedure result set so that the
rows can be returned to the calling application. There can only
be one procedure result set in a stored procedure.
A stored procedure must explicitly process a result set to return it to the calling application. For example:
- Declare the procedure result set through the
RESULTclause of the procedure specification. - Populate the procedure result set in the body of the procedure
using the methods of the
DhSQLResultSetclass.
When the SQL engine creates a Java class from a CREATE PROCEDURE statement
that contains the RESULT clause, it implicitly
instantiates an object of type DhSQLResultSet,
and calls it SQLResultSet. Invoke methods of the SQLResultSet instance
to populate fields and rows of the procedure result set.
This example extends the get_sal procedure to return
a procedure result set:
|
For each row of the SQL result set assigned to procedure variables, the procedure:
- Assigns the current values in the procedure variables to
corresponding fields in the procedure result set with the
DhSQLResultSet.Setmethod - Inserts a row into the procedure result set with the
DhSQLResultSet.Insertmethod