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: 1281
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts RC 20 for Address ISPEXEC "ISRED... pkmurali CLIST & REXX 3 Sun Apr 16, 2017 11:30 pm
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


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