12.17.2006

Recreate sequence using PL/ SQL

Recreate sequence using PL/ SQL:

For example, if the last value used by the Oracle sequence was 100 and you would like to reset the sequence to serve 225 as the next value. You would execute the following commands.

alter sequence seq_name increment by 124;
select seq_name.nextval from dual;
alter sequence seq_name increment by 1;

Now, the next value to be served by the sequence will be 225.

Seems handfull and confusing huh?
But it works just fine.
Just don't use it before exception DUP_VAL_ON_INDEX.
Or else, your sequence will grow like mushroom in rainy season :)

0 comments:

 
Template by yummylolly.com