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

SELECTing a UNCOMMITTED DELETED row


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 2146
Location: At my coffee table

PostPosted: Wed Jul 07, 2010 5:48 pm
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
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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jul 07, 2010 8:07 pm
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: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 8:13 pm
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: 1020
Location: India

PostPosted: Wed Jul 07, 2010 10:37 pm
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: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 10:43 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Selecting the max value from a file. DFSORT/ICETOOL 3
No new posts Selecting multiple constant records DB2 3
No new posts ADRDSSU BY(REFDT... not selecting cor... IBM Tools 3
No new posts RACF- How to find the Last access of ... All Other Mainframe Topics 7
No new posts Selecting a row from multiple tables! DB2 2
Search our Forums:

Back to Top