Wednesday 28 August 2013

Difference between 'TABLE OF' and 'REF CURSOR’?

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 associate difference statement to a cursor variable dynamically.

The main advantage of ref cursor is:
We can return result set to a client which we can't do using normal cursors.
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.

No comments:

Post a Comment