Tuesday, 5 March 2013

How A Cursor Works?

Open:
  • Open the cursor, to execute query and identify active set.
  • If the query returns no rows, no exception is raised.
  • Use cursor attributes to test the outcome after a fetch.

Fetch:
  • To retrieve the current row values into variables.
  • Include the same number of variables.
  • Match each variable to correspond to columns, by position.
  • Test to see if cursor contains rows.

Close:
  • Close cursor after completing processing-rows. Session scope.
  • Reopen cursor, if required.
  • Do not attempt to fetch data from cursor once closed.

No comments:

Post a Comment