1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
set verify off echo off concat off heading off
Rem &1 Owner of the sequence
Rem &2 Name of the sequence
Rem &3 Target value of start
col Difference new_value diff
col Increment_by new_value Increment_by
prompt Current step of the sequence
Select INCREMENT_BY
from DBA_SEQUENCES
where SEQUENCE_OWNER=UPPER('&1') and SEQUENCE_NAME=UPPER('&2');
prompt The difference between current value and target
Select &3 - &1.&2.NextVal Difference from dual;
prompt Alter step of the sequense to &diff
Alter sequence &1.&2 increment by &diff;
prompt If all is OK you will see 0 as a result
Select &3 - &1.&2.NextVal DIFF from dual;
prompt Restore the sequence to initial step
Alter sequence &1.&2 increment by &Increment_by;
prompt If all is OK you will see &3 as a result
Select &1.&2.CurrVal from dual; |