top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How does one find the next value of a sequence in Oracle?

0 votes
379 views
How does one find the next value of a sequence in Oracle?
posted Jun 26, 2015 by Kunal Kapoor

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Perform an "ALTER SEQUENCE ... NOCACHE" to unload the unused cached sequence numbers
from the Oracle library cache. This way, no cached numbers will be lost.
If you then select from the USER_SEQUENCES dictionary view, you will see the correct
high water mark value that would be returned for the next NEXTVALL call.
Afterwards, perform an "ALTER SEQUENCE ... CACHE" to restore caching.
You can use the above technique to prevent sequence number loss before a SHUTDOWN ABORT,
or any other operation that would cause gaps in sequence values.

answer Jun 30, 2015 by Arun Gowda
...