InSQL procedures, a cursor makes it possible to define a result set (a set of data rows) and performs complex logic on a row by row basis. By using the same mechanics, an SQL procedure can also define a result set and return it directly to the caller of the SQL procedure or to a client application.

A cursor can be viewed as a pointer to one row in a set of rows. The cursor can only reference one row at a time but can move to other rows of the result set as needed.

To use cursors in SQL procedures, you need to do the following:

  • Declares a cursor that defines a result set.
  • Open the cursor to establish the result set.
  • Fetch the data into local variables as needed from the cursor, one row at a time.
  • Close the cursor when done.
Please check this link for detailed information 

  Modified On Sep-18-2014 01:23:54 PM

Leave Comment