DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Altering sequences

  1. #1
    Join Date
    Aug 2000
    Posts
    143

    Question

    Does anyone know the syntax for changing the next value of a sequence?

  2. #2
    Join Date
    Jul 2000
    Posts
    296
    You have to drop and recreate the sequence to change the next value.

  3. #3
    Join Date
    Nov 2000
    Posts
    344

    Lightbulb

    Actually there is a way to do this without dropping and recreating, but you need to be sure that no one will be using the sequence while you are doing it :

    Let's say the current value of the sequence is 39, and you want to reset it to 1.

    To do this, you can alter the sequence so it increments by -38, then increment it with a 'select seq.nextval from dual', and finally set the increment back to 1.


    The advantage to doing it this way over dropping and recreating is that you don't have to worry about things becoming invalid

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width