Here in the code section we have tried to select records
from a table called EMP through a ref cursor. The string that selects the
records for the cursor has been dynamically built up as per the choice of table
name and the selection criteria.
This kind of cursor declaration is not possible with the
knowledge of simple cursor where especially the table name is either not known
or cannot be hard coded due to business requirements.
Also, this kind of cursor declaration makes the code
reusable and more efficient.
Execution output
Figure 1
By applying a different table name with the kind of
selection criteria we can fetch a different set of records using the same
procedure.