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

How can we declare a cursor for deleting row using cursor


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

New User


Joined: 03 Mar 2007
Posts: 17
Location: hyd

PostPosted: Fri Oct 10, 2008 4:10 pm
Reply with quote

I want to delete some rows by using cursor.

Please let me know the syntax to declare a cursor for deleting a row..

For update any column we declare cursor as "Declare c1 cursor for select * from table where condition
for update of column-name"

Can we use same syntax "for delete of column-name" for deleting rows by cursor.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Oct 10, 2008 4:21 pm
Reply with quote

i believe the syntax is still for update of column-name.

I have always listed all the columns. don't know if it is required, but when someone else looks at the cursor declaration it is obvious something is going to happen to the complete row.

you could also check the db2 manuals - for a complete definition and description of the declare cursor statement in regard to issuing delete where current cursor.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Oct 10, 2008 4:35 pm
Reply with quote

Dick,

I believe it's not mandatory to have the 'FOR UPDATE OF' to do a positioned DELETE.
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 Deleting a Tape file JCL & VSAM 14
No new posts CA7 deleting files in steps after job... CA Products 4
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
Search our Forums:

Back to Top