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
 

 

SELECTing a UNCOMMITTED DELETED row

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

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Wed Jul 07, 2010 5:30 pm    Post subject: SELECTing a UNCOMMITTED DELETED row
Reply with quote

Hi,
I have a query regarding the islolation level in case of DELETE.

I DELETE a row and before committing , I execute a SELECT for that particular row using WITH RS/RR/CS.
I am getting a SQLCODE 100. I expected that the row should have been SELECTED, since it is not comitted.

I referenced the following URL for DB2 manual.
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/c0007870.htm

Please let me know my understanding is correct.

thanks
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Jul 07, 2010 5:48 pm    Post subject:
Reply with quote

Quote:
Uncommitted Read (UR) allows an application to access uncommitted changes of other transactions.

I would have to wonder why the manual specifies 'other' rather than 'all'....
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Jul 07, 2010 5:52 pm    Post subject:
Reply with quote

DB2 remembers what you have done. just like you can select something you 've just inserted, or insert children of a just inserted parent.

The only way to get a row which is uncommitted deleted is with a cursor that uses a workfile.

Even in another thread with UR you won't see the deleted row.
with CS/RS/RR you won't get past the lock .
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: Wed Jul 07, 2010 8:07 pm    Post subject:
Reply with quote

Hello,

Suggest some re-design be considered.

If it has been deleted - it should not be available.

If it might be needed - do not delete it until it is no longer deleted. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 8:13 pm    Post subject:
Reply with quote

if you are using db2 vsn 8 or 9 (i forget which - refer to the manuals)
there is a new ability to code your sql to select the row which you are deleting - in one sql statement.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Jul 07, 2010 10:37 pm    Post subject:
Reply with quote

Hi,

Here is the link and example
Code:
SELECT * FROM OLD TABLE
    (DELETE FROM employee WHERE emp_id = 12345)

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 10:43 pm    Post subject:
Reply with quote

Sushanth,

Man, are you hot or what!
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 Count the number of rows updated or d... Chetan Kumar DB2 6 Tue Jul 14, 2015 7:57 pm
No new posts DB2 10.1 Share level locking and Sele... Mary Lewis DB2 1 Wed Apr 15, 2015 9:51 pm
No new posts Already written data in VSAM got dele... Tanuz JCL & VSAM 6 Fri Feb 27, 2015 2:01 pm
No new posts Selecting a redefined record layout i... mallik4u Compuware & Other Tools 1 Wed Oct 08, 2014 8:14 am
No new posts Query for selecting single type sharad_shanu DB2 2 Tue Aug 26, 2014 10:09 am


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