Difference between 'TABLE OF' and 'REF CURSOR'

What exactly the difference between 'TABLE OF' and 'REF CURSOR' in PL/SQL?
For what purposes these both might be used?

Questions by dgandhi

Showing Answers 1 - 3 of 3 Answers

A ref cursor is a dynamic cursor in which the contents of cursor can be changed dynamically at run time depending upon our requirement.

A ref cursor is basically a data type. A variable declared based on such data type is called cursor variable. We can assosiate differenct statement to a cursor variable dynamically.

The main advantage of ref cursor is
1. We can  return result set to a client which we can't do using normal cursors.
2. It can be passed as parameter to sub programs.

Table of is use to define a collection type.

Collections are generally used for bulk processing. In cursors the data is processed sequentially. Using collections we can  process all the data in one go.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions