MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL to delete 'N' number of records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
jagfit
Beginner


Joined: 27 Sep 2003
Posts: 5
Topics: 2

PostPosted: Fri Nov 14, 2003 5:27 am    Post subject: SQL to delete 'N' number of records Reply with quote

Hi ,

I need to delete 'N' number of records from a table. Other than using the cursor and deleting , is there any other way out ? For example, like Oracle's ROWNUM , is anything similar avaiable in DB2 ? Or is there any other method available(functions etc) ? Please note that I need to delete the records through program only. So I cannot use unload or any option like that.

Thanks,
_________________
Regards,
Jagfit
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Nov 14, 2003 6:42 am    Post subject: Reply with quote

Jagfit,

why do you need a cursor to delete? A simple delete statement with proper where clause will do. Db2 version & supports Rownum. rownum must be a column in your table.


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jagfit
Beginner


Joined: 27 Sep 2003
Posts: 5
Topics: 2

PostPosted: Fri Nov 14, 2003 8:24 am    Post subject: Reply with quote

Kolusu,

Thanks for the pointer..Did you mean DB2 Version 7 ? Also , can you point me to a manual which describes ROWNUM ? I searched,but could not locate it..

Thanks,
_________________
Regards,
Jagfit
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Nov 14, 2003 8:51 am    Post subject: Reply with quote

Jagfit,

Yes I meant DB2 V7.In DB2 it is actually called ROWID.search in the following link for Rowid

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNAPH11/CCONTENTS?DT=20010710165542

Also check this link for ROWID function.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.70?SHELF=&DT=20010718164132&CASE=

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jagfit
Beginner


Joined: 27 Sep 2003
Posts: 5
Topics: 2

PostPosted: Fri Nov 14, 2003 8:53 am    Post subject: Reply with quote

Thanks Kolusu. I will go through these.
_________________
Regards,
Jagfit
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group