IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to delete rows from a table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pratap v

New User


Joined: 21 Sep 2007
Posts: 2
Location: chennai

PostPosted: Tue Dec 04, 2007 5:27 pm
Reply with quote

hi can any one explain how to delete say some 5 rows (or first 5 rows)
from table
is it possible by cusor

thanks
pratap
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue Dec 04, 2007 5:52 pm
Reply with quote

Using positioned DELETE statements After your program has executed a FETCH statement to retrieve the current row, you can use a positioned DELETE statement to delete that row.
Example:
EXEC SQL DELETE FROM ORG.EMP WHERE CURRENT OF C1 END-EXEC.
Where C1 is the cursor.
And you can control 5 rows deletion in your program.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 04, 2007 9:11 pm
Reply with quote

Hello,

Quote:
can any one explain how to delete say some 5 rows (or first 5 rows)
Hopefully not. . .

What kind of business rule requires or even permits the arbitrary deletion of "some 5 rows"?

Quote:
is it possible by cusor

Yes, once the rules are defined, a cursor can be used to navigate through te rows.
Back to top
View user's profile Send private message
pratap v

New User


Joined: 21 Sep 2007
Posts: 2
Location: chennai

PostPosted: Wed Dec 05, 2007 11:07 pm
Reply with quote

thanks mr srihari and dick
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts Load new table with Old unload - DB2 DB2 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top