Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: about sequence in oracle
As has been talked about numerous times in this newsgroup....
There is only way to ensure that an ALTER SEQUENCE INCREMENT BY and a SELECT NEXTVAL will be one atomic operation. In a system where accessing the sequence occurs quite frequently, you run the risk of someone selecting NEXTVAL before you do so you can have your sequence decremented by 31372 (15686*2). So either drop the sequence and recreate it. Or, if you want to use the ALTER SEQUENCE command, startup the database in restricted mode, alter the sequence, and then open the database.
HTH,
Brian
Honza Pazdziora wrote:
>
> On 14 Aug 2001 09:21:56 -0700, David Fitzjarrell <oratune_at_msn.com> wrote:
>
> > there is no such ALTER SEQUENCE ... START WITH ... option. And, for
> > large discrepancies [starting value of 1, current value 15687] it is
> > far easier to drop and recreate the sequence with the proper starting
> > value than it would be to run through 15686 iterations with a negative
> > increment.
>
> Just do one iteration with increment -15686.
>
> --
> ------------------------------------------------------------------------
> Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
> .project: Perl, mod_perl, DBI, Oracle, auth. WWW servers, XML/XSL, ...
> Petition for a Software Patent Free Europe http://petition.eurolinux.org
> ------------------------------------------------------------------------
Received on Wed Aug 22 2001 - 07:39:18 CDT