Overview
A stored procedure can pass a result set, resulting from execution of a SQL statement, to a client
using a cursor variable (REF CURSOR).
Like a cursor, a cursor variable points to the current row in the result set of a multi-row
query.
Cursor variables are used to pass query result sets between PL/SQL stored
subprograms and client programs. Neither PL/SQL nor any client program owns a
result set.
They share a pointer to the work area where the result set is stored.
The order of processing a result set
The followings are descriptions about a procedure for processing a result set in ALTIBASE HDB.
To see details, refer to the following examples(Passing a REF CURSOR as a parameter).
- Create a typeset which containing a corresponding type. And create user-defined type which is a REF CURSOR.
- Create the stored procedure, which having OUT parameters.
- Execute a procedure.
On the other hand, in case of Oracle, processing a result set can be done as follows
- Declaring REF CURSOR Types and Cursor Variables, passing Cursor Variables As Parameters can be executed in a procedure.
Passing a REF CURSOR as a parameter
The example described below shows how to pass a ref cursor as parameter to a client program in ORACLE.
An example below arouses same result as above in ALTIBASE HDB.