Dear all
I am using dotConnect For Oracle version 6.60.268.
I create a sequence in Oracle 10g as below:
CREATE SEQUENCE MYSEQUENCE
MINVALUE 0 MAXVALUE 999999999999999 INCREMENT BY 1
START WITH 1 CACHE 100 NOORDER NOCYCLE;
Then in my .NET code, I have integrated the dotConnect For Oracle into the Enterprise library and this is how I get the sequence value:
Return DirectCast(oDalc.RunDirectSQLScalar("SELECT MYSEQUENCE.NEXTVAL FROM DUAL"), Decimal)
Now is the unexplained part:
I have 2 separate .NET exe which will get the sequence value at the same time. The first program get 1 and the second program get 100. This is not what I expected.
I expect the first program get 1 and the second program get 2.
Is there anything wrong with the version of dotConnect For Oracle or is there anything wrong with the sequence that I create?
Please kindly advise.
Thanks
Unexplained Behaviour of Sequence in Oracle
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Unexplained Behaviour of Sequence in Oracle
The described behavior is not related to dotConnect for Oracle; it is caused by the definition of your sequence. You use CACHE 100 in your sequence definition. When your first application gets the sequence value, 100 values are cached. And when the second application gets the sequence value, it gets the next free sequence value - 100. For more information, please refer tomyfsh1978 wrote:Is there anything wrong with the version of dotConnect For Oracle or is there anything wrong with the sequence that I create?
http://docs.oracle.com/cd/B12037_01/ser ... sthref5340
http://asktom.oracle.com/pls/apex/f?p=1 ... 0346406705