-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Issue in Sequence
PostPosted: Wed Jun 10, 2009 6:18 am 
Newbie

Joined: Mon Jun 01, 2009 8:59 am
Posts: 12
All,

I have the below sequence ,but the PMT_ID are not getting generated properly.

PMT_ID should start from 1 and increament by 1 as per the below sequence,but actually when i process the data the PMT_ID are generated like 1,2,6,11,16,21,26,,31,36,41 etc. Please help me out in resolving the issue

CREATE SEQUENCE ABC.PMT_ID
AS INTEGER
START WITH 1
INCREMENT BY 1
NOMINVALUE
NOMAXVALUE
NOCYCLE
CACHE 5
ORDER
;


Top
 Profile  
 
 Post subject: Re: Issue in Sequence
PostPosted: Wed Jun 10, 2009 11:32 am 
Newbie

Joined: Wed Jun 10, 2009 11:03 am
Posts: 3
It's probably not a coincidence that every value ( with the exception of the first two) is the previous + 5 and that you have a clause "CACHE 5" in your sequence. This is what Oracle( I assume it's ORACLE you're using) documentation says about the CACHE clause:

Quote:
CACHE Specify how many values of the sequence Oracle preallocates and keeps in
memory for faster access. This integer value can have 28 or fewer digits. The
minimum value for this parameter is 2. For sequences that cycle, this value must be
less than the number of values in the cycle. You cannot cache more values than will
fit in a given cycle of sequence numbers. Therefore, the maximum value allowed for
CACHE must be less than the value determined by the following formula:
(CEIL (MAXVALUE - MINVALUE)) / ABS (INCREMENT)
If a system failure occurs, all cached sequence values that have not been used in
committed DML statements are lost. The potential number of lost values is equal to
the value of the CACHE parameter.

Are you sure you didn't have any system failures?


Top
 Profile  
 
 Post subject: Re: Issue in Sequence
PostPosted: Wed Jun 10, 2009 11:48 am 
Newbie

Joined: Mon Jun 01, 2009 8:59 am
Posts: 12
Hi, Thanks for response..Its an DB2 databases


Top
 Profile  
 
 Post subject: Re: Issue in Sequence
PostPosted: Wed Jun 10, 2009 11:57 am 
Newbie

Joined: Wed Jun 10, 2009 11:03 am
Posts: 3
Never worked with DB2, but I guess it's the same principle.
Try removing that CACHE clause and see how it behaves.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.