Page 1 of 1

Mass delete using cursors

Posted: Wed Dec 28, 2011 4:33 pm
by sonakasi
Hi All,

In an interview, I have been questioned as,,
is it possible to do mass delete of rows on a table using cursors.???

Posted: Wed Dec 28, 2011 9:24 pm
by DikDude
Yes, it is possible (depending on what is meant by "mass delete"). It should also probably not be done. . .

Posted: Wed Dec 28, 2011 10:15 pm
by dbzTHEdinosauer
you do not have mass delete with a cursor.
mass delete usually refers to searched-conditions
where as with a cursor it is a positioned delete:
you can delete
current row
row set (in which there would/could be more than one row.

basic answer, IMUO, NO.

Posted: Thu Dec 29, 2011 12:39 am
by DikDude
Probably my bad. . .

I was thinking of a programmer who one asked me why reading more than a million rows with a cursor and deleting most of them took so long. . . :wink:

Told him deleting rows en masse via a cursor was not a good approach.

Posted: Thu Dec 29, 2011 1:19 pm
by sonakasi
Thanks for explanation.... :D