Plsql updating in cursor

Oracle provides the FOR UPDATE clause in SQL syntax to allow the developer to lock a set of Oracle rows for the duration of a transaction.The syntax of using the WHERE CURRENT OF clause in UPDATE and DELETE statements follows: WHERE [CURRENT OF cursor_name | search_condition] The following example opens a cursor for employees and updates the commission, if there is no commission assigned based on the salary level.As the result, Oracle created PL/SQL cursor to provide these extensions.A PL/SQL cursor is a pointer that points to the result set of an SQL query against database tables.In PL/SQL, you can refer to the most recent implicit cursor as the SQL cursor, which always has attributes such as %FOUND, %ISOPEN, %NOTFOUND, and %ROWCOUNT.The SQL cursor has additional attributes, %BULK_ROWCOUNT and %BULK_EXCEPTIONS, designed for use with the FORALL statement.

Oracle creates a memory area, known as the context area, for processing an SQL statement, which contains all the information needed for processing the statement; for example, the number of rows processed, etc. The set of rows the cursor holds is referred to as the active set.The following picture describes steps that you need to follow when you work with a PL/SQL cursor: .If the cursor was defined with a parameter list, you need to pass corresponding arguments to the cursor.The FOR UPDATE clause in the SELECT statement can only be specified in the top level; subqueries cannot have this clause.Another Example of WHERE CURRENT OF Go through all Maths students and set all GPA’s under 4.0 to 4.0!

Leave a Reply