Mass delete using cursors

Ask question on - DataBase Concepts, IBM Mainframe DB2, DB2/UDB, DB2 Tools, SQL , DB2 programming with languages like COBOL, PL1.

Moderators: Kalicharan, Moderator Group

Post Reply
sonakasi
Member
Posts: 20
Joined: Wed Nov 09, 2011 9:09 am
Location: India

Mass delete using cursors

Post by sonakasi » Wed Dec 28, 2011 4:33 pm

Hi All,

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

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Dec 28, 2011 9:24 pm

Yes, it is possible (depending on what is meant by "mass delete"). It should also probably not be done. . .
Last edited by DikDude on Thu Dec 29, 2011 12:34 am, edited 1 time in total.
Have a good one

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Dec 28, 2011 10:15 pm

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
or
row set (in which there would/could be more than one row.

basic answer, IMUO, NO.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Dec 29, 2011 12:39 am

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.
Have a good one

sonakasi
Member
Posts: 20
Joined: Wed Nov 09, 2011 9:09 am
Location: India

Post by sonakasi » Thu Dec 29, 2011 1:19 pm

Thanks for explanation.... :D
SONA KASI

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others