Cursors

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 3

MECHANISM

CURSORS
INTRODUCTION:
o A cursor is a mechanism that allows to retrieve rows one at a time
from a relation.
o It is a solution for impedance mismatch problem that occurs
because SQL operates on sets of records, whereas languages like C
do not cleanly support a set-of-records abstraction.
o We can declare a cursor on any relation or on any SQL query.
o Once a cursor is declared we can do the following operations:
i. Open it
ii. Fetch the next row
iii. Move the cursor :
a. To the next row
b. To the row after next ‘n’
c. To the first row
d. To the previous row
iv. Close the cursor

You might also like