Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SEQUENCE: Unexpected behavior of sequence increment when the date changes

User630055-OracleJun 6 2012 — edited Jun 8 2012
I am using a sequence with the following definition.

CREATE SEQUENCE MyPersonSequence MINVALUE 1 NOMAXVALUE START WITH 1 INCREMENT BY 1 NOYCLE NOCACHE ORDER;

From the definition, it is clear that the sequence has to be incremented by 1. It gets incremented by 1 on the same day. If I try to use the sequence on the next day, it is incrementing the sequence by 2 for the first time.

Ex: On 06-Jun-2012, I increased the sequence 3 times.
Lets say the initial value of the sequence is 100.
I get 101,102,103 respectively when I run the MyPersonSequence .nextval command. I leave it there.

Next day morning(i.e. on 07-Jun-2012), run the seqeunce.nextval command. The value should come as 104, but it shows the value as 105(increased by 2).
After that, if I run the sequence.nextval, I get the values 106,107,108, .....(Increase by 1).

The above situation repeats when the system date changes again.


What could be the reason for this weird behavior?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 6 2012
Added on Jun 6 2012
16 comments
996 views