Creating cursors in sql and updating each line in cursor
These attributes give more information about the cursor operations.Below are the different cursor attributes and their usage.ISO Syntax DECLARE cursor_name [ INSENSITIVE ] [ SCROLL ] CURSOR FOR select_statement [ FOR ] [;] Transact-SQL Extended Syntax DECLARE cursor_name CURSOR [ LOCAL | GLOBAL ] [ FORWARD_ONLY | SCROLL ] [ STATIC | KEYSET | DYNAMIC | FAST_FORWARD ] [ READ_ONLY | SCROLL_LOCKS | OPTIMISTIC ] [ TYPE_WARNING ] FOR select_statement [ FOR UPDATE [ OF column_name [ ,...n ] ] ] [;] must conform to the rules for identifiers.INSENSITIVE Defines a cursor that makes a temporary copy of the data to be used by the cursor.
We will project all the employee's name from emp table using a cursor. Oracle creates context area for processing an SQL statement which contains all information about the statement.PL/SQL allows the programmer to control the context area through the cursor.For example, suppose a static cursor fetches a row, and another application then updates that row.If the application refetches the row from the static cursor, the values it sees are unchanged, despite the changes made by the other application. KEYSET Specifies that the membership and order of rows in the cursor are fixed when the cursor is opened.
The cursor is only implicitly deallocated at disconnect. All insert, update, and delete statements made by the current user (or committed by other users) that affect rows in the result set are visible as the rows are fetched.