Re: How do we set new value for a SEQUENCE?

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Tue, 22 Feb 2000 16:28:39 GMT
Message-ID: <38b8ae54.6712942_at_netnews.worldnet.att.net>


I can vouch for this technique. I've used it myself. The only thing I can add is suggest that you use it when you are reasonably certain that the sequence isn't being accessed. If someone access the sequence while you have the increment set to other than 1, it messes up what you are trying to do. I usually script it so I can execute all the statements quickly. That way I minimize my exposure.

Jonathan



jonathan_at_gennick.com
http://gennick.com
Brighten the Corner Where You Are

On Tue, 22 Feb 2000 14:42:52 +0300, Valeri Sorokine <vsorokin_at_dd.ru> wrote:

>Suppose you want to set it to the value Y
>
> select seqcnt.nextval into X from dual;
> alter sequence seqcnt increment by (Y-X);
> select seqcnt.nextval into X from dual; -- you'll get the value Y :-)
> alter sequence seqcnt increment by 1;
>
>Hope that helps.
Received on Tue Feb 22 2000 - 17:28:39 CET

Original text of this message