Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Is "FOR UPDATE" is neccessary while declaring Dele

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
karnataka

New User


Joined: 15 Sep 2006
Posts: 20
Location: bangalore

PostPosted: Mon Sep 06, 2010 9:42 pm    Post subject: Is "FOR UPDATE" is neccessary while declaring Dele
Reply with quote

Hi,

I am using cursor for deleting a record. Could you please tell me whats the use of "For UPdate" while declaring cursor in this case. Is this mandatory?

Thanks,
Jyothi
Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Mon Sep 06, 2010 10:39 pm    Post subject:
Reply with quote

Hello,

Suggest that you are not using a cursor for deleting. . .

You are using a cursor for reading. Once a row is read (for update) it can be deleted.
Back to top
View user's profile Send private message
karnataka

New User


Joined: 15 Sep 2006
Posts: 20
Location: bangalore

PostPosted: Mon Sep 06, 2010 11:02 pm    Post subject:
Reply with quote

Sorry.. Dick

Do you mean to say "FOR UPDATE" clause is not mandatory for cursor , incase if cursor is using for deleting record.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Sep 07, 2010 12:25 am    Post subject:
Reply with quote

Hello,

Quote:
Do you mean to say "FOR UPDATE" clause is not mandatory for cursor , incase if cursor is using for deleting record.
Exactly the opposite. . .

In order to update/delete a fetched row, the row must be "held" - read FOR UPDATE.

One of the most basic concepts in every database system is that in order to update/delete data, the process must have control of that data (i.e. "held", "locked", etc).
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Tue Sep 07, 2010 4:47 pm    Post subject:
Reply with quote

"for update" is not mandatory, but it helps to detect a read-only cursor you wish to use for update.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us