What is cursor? and Types of Cursor?
there are two type of operation in sqlserver 1>row by row operation 2> set by row operationrow by row execution of the result set is called cursorType Of Cursor Static dynamic keyset fast_forward
A cursor is a handle (pointer) in memory for a DML operation (Select Update).There are mainly 2 types of cursors .1) Implicit Cursor.2) Explicit Cursor.Implicit cursor: Oralce will implicitly creates an area for the DML operations. Programmer will not have control on implicit cursors. The only useful attribute on this implicit cursor is SQL ROWCOUNT it will give the number of rows affected by the recent DML operation.The only Implicit cursor is SQL.Explicit Cursor: Explicit cursors are created by the programmer and programmer have control on itProgrammer can 1) Open2) Close3) Fetch and do some manipulations on the values Explicit Cursors are classified into 1) Normal cursor2) Parameterized cursor3) Cursor For Loops and 4) REF cursors REF Cursors: Normally when we create a normal cursor we cant change the select query associated to that query (the query which is given at the time of definition) But using REF cursors we can change the cursor statement also. These REF cursors are useful when we are sending data from one environment to another environment. Visit: http://kalitinterviewquestions.blogspot.com/
1) Open2) Close3) Fetch
and do some manipulations on the values Explicit Cursors are classified into
1) Normal cursor2) Parameterized cursor3) Cursor For Loops and 4) REF cursors
REF Cursors:
Normally when we create a normal cursor we cant change the select query associated to that query (the query which is given at the time of definition)
But using REF cursors we can change the cursor statement also.
These REF cursors are useful when we are sending data from one environment to another environment.
Visit: http://kalitinterviewquestions.blogspot.com/
cursor allows row by row execution of the result set
Cursor :
Cursors are special programming constructs that allow data to be manipulated on a row-by-row basis, similar to other structured programming languages. They are declared like a variable, and then move one record at a time using a loop for control...
Types Of Cursor ?
Static cursorsA static cursor always displays the result set as it was when the cursor was opened. Static cursors are always read-only.Dynamic CursorsDynamic cursors are the opposite of static cursors. Dynamic cursors reflect all changes made to the rows in their result set when scrolling through the cursor.Forward-only CursorsA forward-only cursor does not support scrolling; it supports only fetching the rows serially from the start to the end of the cursorKeyset-driven CursorsThe keyset is the set of the key values from all the rows that qualified for the SELECT statement at the time the cursor was opened......