Multiple choice technology databases

Consider a sequence whose currval is 1 and gets incremented by 1 by using the nextval reference we get the next number 2.Suppose at this point we issue an rollback and again issue a nextval.What will the output be ?

  1. 2

  2. 3

  3. 4

  4. 1

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Oracle sequences are not rolled back. When you increment a sequence using NEXTVAL, the value is permanently advanced regardless of transaction status. After getting 2 from NEXTVAL, rolling back the transaction doesn't reset the sequence. The next NEXTVAL will return 3, continuing from where it left off.