While updating records using cursor

Microsoft is conducting an online survey to understand your opinion of the Msdn Web site.

If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.

A cursor is a pointer to a private SQL area that stores information about the processing of a SELECT or data manipulation language (DML) statement (INSERT, UPDATE, DELETE, or MERGE).

Cursor management of DML statements is handled by Oracle Database, but PL/SQL offers several ways to define and manipulate cursors to execute SELECT statements.

As promised in the My SQL Cursors and Loops article, this article explores the use of cursors and their role in stored procedure programming.

A cursor is a special kind of loop for traversing through an SQL resultset one row at a time.

Cursor declarations must appear after variable and condition declarations but before handler declarations.

Also keep in mind that the cursor SELECT statement cannot have an INTO clause; it's strictly read-only.

It then declares an insert_cursor to iterate through rows of Sales.

Sales Order Detail table and gets values of salesorderid and orderqty into @orderid and @orderqty variables respectively.

In the online version (which also matches the quiz offered at PL/SQL Challenge, both a and b are correct.

Visit PL/SQL Challenge to read a complete explanation of the answers to this quiz. If the SELECT statement identifies more than one row to be fetched, Oracle Database will raise the TOO_MANY_ROWS exception.

Using the cursor FOR loop construct is a declarative way of asking Oracle Database to fetch each of the rows specified by your cursor and then execute the loop body for that row.