RE: Grabbing sequence values blocks in consecutive order: Need a guaranteed method.
Date: Wed, 25 Mar 2009 11:07:30 -0400
Message-ID: <6AFC12B9BFCDEA45B7274C534738067F140DEC7B_at_AAPQMAILBX02V.proque.st>
Um, unless I'm missing something, the approach outlined at the URL below is subject to a classic race condition. This is a really *BAD* idea! Don't do it!
Oracle provides DBMS_LOCK for a reason. Implement DBMS_LOCK in your code, as Riyaj suggested previously, and there will not be an issue. Doing the way it's outlined in that article, (ab)using DBMS_APPLICATION_INFO, is a really bad idea.
-Mark
-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of FmHabash
Sent: Wednesday, March 25, 2009 11:01 AM
To: amar.padhi_at_gmail.com; oracle-l_at_freelists.org
Subject: RE: Grabbing sequence values blocks in consecutive order: Need a guaranteed method.
I like this a lot. Will this work with connection pooling where physical connections are being reused.
-----Original Message-----
From: Amar Kumar Padhi <amar.padhi_at_gmail.com>
Sent: Wednesday, March 25, 2009 12:01 AM
To: oracle-l_at_freelists.org
Subject: Re: Grabbing sequence values blocks in consecutive order: Need a guaranteed method.
Another method would be to make use of application locks to actually create serial access to sequences. This can be achieved by using dbms_application_info to update v$session and then referring this value for releasing resources to one session at a time. I have used this logic in different scenarios to avoid two sessions from using the same resource. has worked perfectly.
Thanks!
Amar
Www.amar-Padhi.com
-original message-
Subject: Re: Grabbing sequence values blocks in consecutive order: Need a guaranteed method.
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
†Ûiÿü0ÁúÞzX¬¶Ê+ƒün– {ú+iÉ^ Received on Wed Mar 25 2009 - 10:07:30 CDT