Home » SQL & PL/SQL » SQL & PL/SQL » How to read UNCOMMITED data in Oracle? (Oracle 11g Enterprise Edition 11.2.0.1.0 - Linux 2.6)
How to read UNCOMMITED data in Oracle? [message #605384] Thu, 09 January 2014 01:38 Go to next message
usaha1
Messages: 4
Registered: January 2014
Location: India
Junior Member
I have a table:

create table Task_actn
(
actn_id number(19) primary key,
task_cde char(5),
task_stat_dsc varchar2(256),
task_actn char(1) constraint ck_01 check (task_actn in ('A','N'))
);
where 'A' stands for "Active" and 'N' stands for "New"

As per business task_actn will be 'N' for a newly created task and it'll be 'A' when it is assigned to any agent. Hence a transaction update the value of task_actn to 'A' once it read any newly created task.

Our requirement is we want to allow other transactions to read the updated value of task_actn before commit occur. As per my knowledge oracle allow only read committed and serializable isolation level and dirty read is not possible.

Is there any workaround to make this possible? Please help....
Re: How to read UNCOMMITED data in Oracle? [message #605385 is a reply to message #605384] Thu, 09 January 2014 01:42 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
usaha1 wrote on Thu, 09 January 2014 13:08

Our requirement is we want to allow other transactions to read the updated value of task_actn before commit occur.


Are those other transactions happening in the same session?
Or do you want to tackle with transaction isolaton levels?

[Updated on: Thu, 09 January 2014 01:48]

Report message to a moderator

Re: How to read UNCOMMITED data in Oracle? [message #605389 is a reply to message #605385] Thu, 09 January 2014 02:14 Go to previous messageGo to next message
usaha1
Messages: 4
Registered: January 2014
Location: India
Junior Member
Transaction might happen from different session as well.
Re: How to read UNCOMMITED data in Oracle? [message #605390 is a reply to message #605384] Thu, 09 January 2014 02:14 Go to previous messageGo to next message
Michel Cadot
Messages: 68647
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

No.... hopefully.

I don't see any reason to see something that does not exist (per transaction principle) in the database.

Workaround: forget (logical) transaction and commit each statement.

Re: How to read UNCOMMITED data in Oracle? [message #605391 is a reply to message #605389] Thu, 09 January 2014 02:17 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Read this
Re: How to read UNCOMMITED data in Oracle? [message #605392 is a reply to message #605390] Thu, 09 January 2014 02:30 Go to previous messageGo to next message
usaha1
Messages: 4
Registered: January 2014
Location: India
Junior Member
Basically we are using multiple listners from application end and those listners will read the tasks from the table Continuously and Concurrently. So when a listner will be reading any particular data it'll update the 'task_actn' to 'A' at the same time. So we want if any other listner will try to read the same record before commit it'll see the 'task_actn' for that task as 'A'. So it'll not process the same record...

This is our requirement. Would you kindly suggest any workaround to implement this?
Re: How to read UNCOMMITED data in Oracle? [message #605393 is a reply to message #605392] Thu, 09 January 2014 02:32 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Have each listener lock the records it's dealing with.
Re: How to read UNCOMMITED data in Oracle? [message #605394 is a reply to message #605392] Thu, 09 January 2014 02:32 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Oracle will not read uncommitted data across transactions. Way around it? Commit the data.
Re: How to read UNCOMMITED data in Oracle? [message #605403 is a reply to message #605392] Thu, 09 January 2014 02:47 Go to previous messageGo to next message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
usaha1 wrote on Thu, 09 January 2014 09:30
Basically we are using multiple listners from application end and those listners will read the tasks from the table Continuously and Concurrently. So when a listner will be reading any particular data it'll update the 'task_actn' to 'A' at the same time. So we want if any other listner will try to read the same record before commit it'll see the 'task_actn' for that task as 'A'. So it'll not process the same record...

This is our requirement. Would you kindly suggest any workaround to implement this?

SELECT ... FOR UPDATE SKIP LOCKED;
from all listners.
http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_10002.htm#SQLRF55369
Re: How to read UNCOMMITED data in Oracle? [message #605405 is a reply to message #605403] Thu, 09 January 2014 02:57 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
How will that return uncommitted data? I assume I'm not 'getting it', need more coffee.
Re: How to read UNCOMMITED data in Oracle? [message #605407 is a reply to message #605405] Thu, 09 January 2014 03:06 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
It doesn't need to. They find a record and update it (but don't commit it). Other sessions need to skip those records. OP wanted to do it by checking the value that's updated, but that's not necessary since the record is locked.
Re: How to read UNCOMMITED data in Oracle? [message #605410 is a reply to message #605407] Thu, 09 January 2014 03:20 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Ahhhh, like I said, need more coffee. Thanks for explaining to the hard of thinking Smile
Re: How to read UNCOMMITED data in Oracle? [message #605430 is a reply to message #605410] Thu, 09 January 2014 05:46 Go to previous message
usaha1
Messages: 4
Registered: January 2014
Location: India
Junior Member
'Have each listener lock the records it's dealing with' - this is only work around as per my understanding. It'll not allow other listner to read the uncommit data however also not allow to read the locked record untill commit.

Thanks to all for your inputs.
Previous Topic: SELECT * FROM OPENQUERY([127.0.0.1],'@cmd') (merged)
Next Topic: To display count for each day in a month
Goto Forum:
  


Current Time: Fri Apr 26 15:19:34 CDT 2024