Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sequences
Ed Gillispie wrote:
>
> Does any one know of a way that you can alter the starting number of a
> sequence with out dropping the sequence.
Hi,
REM get the increment value column a new_value inc select increment_by a from user_sequences where sequence_name = 'sequence_name' ; REM get the how the difference to go to the value you need column a new_value seq_val select &val_you_want - sequence_name.nextval - &inc a from dual ; REM HOPE NOBODY TOUCH THE SEQUENCE FOR THE MOMENT. Alter sequence sequence_name increment by &seq_val ; select sequence_name.nextval from dual ; Alter sequence sequence_name increment by &inc ; REM EVERYBODY CAN PLAY WITH THE SEQUENCE NOWRegards François