Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts Include/omit with "ALL" pa... mgl DFSORT/ICETOOL 6 Wed Jun 14, 2017 2:31 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us