Cursors
Rows returned by the SQL query are those which match the condition. It can either be zero or more at a time.
Sometimes you need to traverse through the rows one by one, forward or backwards
Life Cycle of Cursor
DECLARE
OPEN
FETCH
CLOSE
Cursor enable SQL to retrieve ( or update, or delete ) a single row at a time.
Cursor needs to be created in
cursor-scrollability
:SCROLL
ORNO SCROLL
,NO SCROLL
mean the cursor cannot scrol backward.query-expression
: You can use any legal SELECT statement as a query expression. The result set rows are considered as scope of the cursor.
Example
Cursor with Parameters
Opening a cursor
Opening an unbound cursor
Opening un bound cursor
Opening an un bound cursor with dynamic query
Last updated