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

Update Column Value through two different processes.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 20, 2011 5:22 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts first column truncated in search result IBM Tools 13
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
Search our Forums:

Back to Top