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
 

 

Update Column Value through two different processes.

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

New User


Joined: 16 Sep 2009
Posts: 15
Location: Hyd,Ind

PostPosted: Wed Apr 20, 2011 4:59 pm    Post subject: Update Column Value through two different processes.
Reply with quote

Two process are trying to update the below query simultaeneously-

Update table name set col=col + 1;

The table is getting updated only once while the count should increase by two,
Can somebody please suggest if it is possible to update the table and how.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Apr 20, 2011 5:06 pm    Post subject:
Reply with quote

Quote:
The table is getting updated only once while the count should increase by two,
Can somebody please suggest if it is possible to update the table and how.

Thats silly.. Why you want to do so..

If you state your original requirement (not how to do way you want) .. folks here might help in better way...
Back to top
View user's profile Send private message
Gopal Tripathi

New User


Joined: 16 Sep 2009
Posts: 15
Location: Hyd,Ind

PostPosted: Wed Apr 20, 2011 5:18 pm    Post subject:
Reply with quote

Actually , there is one more table and whenever a row is inserted into that table , one count is incremented in this table.what happening here is that two processes are inserting two rows and the count what is getting updated is only 1.My requirement is there a way so that when the two processes inserts two rows the count should increment by two here and not one.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7997
Location: Bellevue, IA

PostPosted: Wed Apr 20, 2011 5:22 pm    Post subject:
Reply with quote

Quote:
Two process are trying to update the below query simultaeneously-
One of three possibilties comes to mind: (1) you have not stated what you're trying to do well, (2) you have no idea what record locking is and why it is used, or (3) you are insane.

Google is your friend. Googling database record locking returns 55,000,000 hits and on the very first page is a reference that contains this excellent quote:
Quote:
Record locking is the technique of preventing simultaneous access to data in a database, to prevent inconsistent results.
If you truly want to update a database value twice at the same time you have many, many, many problems. Hopefully you merely have not stated your requirement well.
Back to top
View user's profile Send private message
Peter Nancollis

New User


Joined: 15 Mar 2011
Posts: 47
Location: UK

PostPosted: Thu Apr 21, 2011 7:10 am    Post subject:
Reply with quote

Ahhh Google the new application programmer , the new DBA ....
but to matters in hand
"The table is getting updated only once while the count should increase by two,
Can somebody please suggest if it is possible to update the table and how.
"
DB2 will allow multiple updates to multiple columns in multiple tables ... all at the same time ....IF it can guarentee the integrity of the data

If you application [tables/code ] are correct this will happen ... if not it wont !
DB2 will tell you which bit hasnt worked !
Back to top
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Thu Apr 21, 2011 4:58 pm    Post subject:
Reply with quote

This might be happening because your row is not getting locked once the program has accessed it. check your isloation level, if its CS, change it to RR. but do remember to commit frquently when you use RR to avoid -911 in the other simultaneous running program.
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
This topic is locked: you cannot edit posts or make replies. DB2 query Using Recursion, Converting... smilewithashu2 DB2 3 Tue Jan 03, 2017 12:50 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


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