When we try to update the salary column of the EMPLOYEES table using the WHERE CURRENT OF clause, the block fails with an ORA-01410: invalid ROWID error as there is no way to specify the This scenario can be manhandled by fetching the rowid of the intended table in the cursor associated SELECT statement and using it in the WHERE clause of the DELETE or the UPDATE statement instead of the WHERE CURRENT OF clause as shown in the below listing. For complete notes on programming in PL/SQL, we recommend the book Advanced PL/SQL: The Definitive Reference by Boobal Ganesan.This is a complete book on PL/SQL with everything you need to know to write efficient and complex PL/SQL code.
We must declare the cursor with the FOR UPDATE clause to use this feature.
After a TCL operation is performed, the cursor pointer gets reset and the cursor will be no longer accessible, thus results in an error when fetched further as shown below.
Thus, any TCL operation on the cursor record set has to be done only after fetching all the rows from the cursor context area using a loop process similar to the above listing example.
Summary: in this tutorial, you will learn about PL/SQL cursor and its usage.
A cursor is a pointer that points to a result of a query.12 v_salary := 100; 13 FOR v_employee Info IN c_Registeredemployee LOOP 14 15 16 -- Update the row we just retrieved from the cursor.