SQL Assignment:
Discuss why and when cursors could be used.
Cursors are used by database programmers to process individual rows returned by database system queries. Cursors enable manipulation of whole result sets at once.
In SQL procedures, a cursor makes it possible to define a result set (a set of data rows) and perform complex logic on a row by row basis. By using the same mechanics, a SQL procedure can also define a result set and return it directly to the caller of the SQL procedure or to a client application.
when to use cursor
There are some conditions when we want to get record from one table and need to insert into another with performing some logic or some conditions .For example if we want to get value from one table row by row and need to perform some logic over that and update /insert into another table then we can use cursors. Cursor basically works as for/While loop.
Get Answers For Free
Most questions answered within 1 hours.