Re: Reseting an Oracle sequence

From: David Rolfe <drolfe_at_eng>
Date: 1995/11/13
Message-ID: <488ca4$nn8_at_engnews2.Eng.Sun.COM>#1/1


In article amm_at_jalisco.optimum.net, tjb839_at_zacatecas.optimum.com (Tim Boemker) writes:
> In article <47s1qd$254_at_norman.cmutual.com.au>
> DSylva_at_colonial.com.au (David Sylva) writes:
>
> > Does anyone know a way to reset a sequence in Oracle 7.1.6.
> >
> > I know that I can drop and recreate it, but this does not
> > suit my purposes

Try this:

  1* select fred.nextval from dual

   NEXTVAL


      1201

SQL> alter sequence fred increment by -1000;

Sequence altered.  

SQL> select fred.nextval from dual;

   NEXTVAL


       201

SQL> alter sequence fred increment by 1;

Sequence altered.

SQL> select fred.nextval from dual;

   NEXTVAL


       202

SQL>
>
> Just out of curiosity, why don't you want to drop & recreate the
> sequence?
>

Because he'll lose all the grants based on it.

David Rolfe,
SunSoft,
Mountain View,
CA Received on Mon Nov 13 1995 - 00:00:00 CET

Original text of this message