Returning a REF CURSOR From a Function v13
In the following example the cursor variable is opened with a query that selects employees with a given job. Note that the cursor variable is specified in this function’s RETURN
statement so the result set is made available to the caller of the function.
This function is invoked in the following anonymous block by assigning the function’s return value to a cursor variable declared in the anonymous block’s declaration section. The result set is fetched using this cursor variable and then it is closed.
The following is the output when the anonymous block is executed.