Sp_sequence_get_range equivalent in Oracle

oracleoracle-11g-r2sequence

Do we have sp_sequence_get_range equivalent in Oracle.

I need to advance my sequence by some numbers always how can I achieve this.

Best Answer

Just alter then increment the sequence.

For example, to increment by 1000:

ALTER SEQUENCE yoursequence INCREMENT BY 1000;

You then have to SELECT the NEXTVAL from the sequence and re-alter it to increment by the usual value to restore "normal" operation.

To check the current value without incrementing:

SELECT yoursequence.CURRVAL FROM DUAL;

If you need to decrease the sequence, just ALTER SEQUENCE by a negative amount (very intuitive!).