Cursor in SQL


  • Cursor holds the pointer to the context Area.
  • It holds the number of rows provided by the SQL statement.
  • Number of rows is called Active Set.
  • There are two types of Cursor
  • 1) Implicit Cursor
  • 2) Explicit cursor(user defined cursor)
  • System automatically creates Implicit cursor.
  • Cursor has attributes : %FOUND, %ISOPEN, %NOTFOUND, %ROWCOUNT,%BULK_ROWCOUNT %BULK_EXCEPTIONS etc 
  • Explicit cursor has following Steps:
  • 1.Declaring cursor for memory initialization
  • 2.Opening the cursor for memory allocation.
  • 3.Fetching the cursor for data retrival 
  • 4.Closing the cursor for to release memory.