Oracle Sequences - Can we rollback a sequence

jdbc, oracle, sequence

Solution

Yes, use `alter sequence`. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_2011.htm.

But note there is no real use for this. Unless you delete all records from your tables that use your sequence, you'll get errors when you use the sequence for creating unique IDs.

And you will always have "holes" in your generated numbers, there is no point in trying to make IDs created by sequences contiguous. Imagine user A doing an insert, user B doing another insert, user B commits, user A rolls back. The sequence number that A used will be lost, as B used a higher one.

Problem

I am using oracle 11g . i came across creating sequences, it raised a question Is it possible to rollback a sequence using java? If we can , pls suggest me ?

Original source

Related problems