datingsite russia - Pl sql updating current record in cursor

by  |  04-Aug-2019 04:44

When the Fetch clause is used with a cursor having a FOR UPDATE clause, the PL/SQL unit fails when we try to open the cursor with an ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc. The error description shows that the internal mechanism for the Fetch clause uses either a DISTINCT or a GROUP BY clause which is not permitted alongside the FOR UPDATE clause.In this scenario, the cursor result set can be limited using the traditional When we associate a SELECT statement with more than one table joined together to a cursor with a FOR UPDATE clause, we end up locking all the tables in the FROM clause of the SELECT statement, where we just need to lock a single table for our purpose.

pl sql updating current record in cursor-50

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.

17 UPDATE employee 18 SET salary = salary v_salary 19 WHERE CURRENT OF c_Registeredemployee; 20 END LOOP; 21 22 -- Commit our work.

Oracle defines an execution cycle to execute an SQL statement and associates a cursor with it.

The following illustration shows the execution cycle of an explicit cursor: Let’s examine each step in detail.

The FOR UPDATE OF clause helps us in locking up the intended table rather all available tables.

Community Discussion