Updating tables within cursor loop
The following sections describe all the query-processing features that explicit cursors provide.In traditional database programming, you process query results using an internal data structure called a cursor.
Because explicit cursors are so flexible, you can choose from different notations depending on your needs.BEGIN FOR item IN ( SELECT object_name, status FROM user_objects WHERE object_type = 'INDEX' AND object_name NOT LIKE '%$%' ) LOOP dbms_output.put_line('Index = ' || item.object_name || ', Status = ' || item.status); END LOOP; END; / loop, PL/SQL fetches into the implicitly declared record.The sequence of statements inside the loop is executed once for each row that satisfies the query.statements might credit one bank account and debit another.It is important not to allow one operation to succeed while the other fails.It might be in a different scope (for example, in a sub-block).
To save an attribute value for later use, assign it to a Boolean variable immediately.
You use three commands to control a cursor: You must declare a cursor before referencing it in other statements.
You give the cursor a name and associate it with a specific query.
UPDATE emp SET ROW = emp_rec WHERE eno = 100; END; / statements in SQL) and access individual fields or entire rows from the result set.
Depending on the complexity of the processing that you want to do on the query results, you can use various notations.
At the end of a transaction that makes database changes, Oracle makes all the changes permanent or undoes them all.