Posts

Showing posts with the label cursors

cursors

Cursors In a previous lecture we saw how we can use SQL statements in PL/SQL. As you remember this way has a disadvantage, namely, all our statements should return only one row. This functionality is enhanced through the use of cursors, which allow a program to take explicit control of SQL statement processing. In order to process a SQL statement, Oracle will allocate an area of memory known as the context area . The context area contains information necessary to complete the processing (including the number of rows processed, a pointer to the parsed representation of the statement, set or rows returned by the query). A cursor is a handle, or pointer, to the context area. Through the cursor, a PL/SQL program can control the context area and what happens to it as a statement is processed. Processing explicit cursors The four steps necessary for explicit cursor processing are as follows: Declare the cursor. Open the cursor for a query. ...