Re: How do we set new value for a SEQUENCE?
Date: Tue, 22 Feb 2000 14:42:52 +0300
Message-ID: <38B2763C.672DFAF5_at_dd.ru>
Hi Ingvar,
You CAN set the sequence to the new value without recreating it.
You can even decrement it! :-)
So, try to use this technique:
[Quoted] 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.
Ingvar Larsson wrote:
>
> We have a sequence counter we wants to give new value for the next sequence
> value.
>
> Example
>
> SELECT seqcnt.nextval FROM dual; returns 1
>
> Than we executes something like
> ALTER SEQUENCE seqcnt NEXTVAL 20;
>
> and the next
> SELECT seqcnt.nextval FROM dual; returns 20
>
> How do we do this?
>
> /Ingvar
-- Valeri Sorokine Oracle Certified Application Developer, Rel.2 ProSoft, Russia, Moscow, Information Systems Division Phone: +7 (095) 234 0636 ; FAX: +7 (095) 234 0640 E-mail: vsorokin_at_dd.ru ; http://www.dd.ruReceived on Tue Feb 22 2000 - 12:42:52 CET