Using the system table SEQUENCES, you can determine the following database information, among other things:
·
All sequences with an
incremental value that is not +1 and the value limits of the sequences
SELECT
owner, sequence_name, increment_by, min_value, max_value
FROM DOMAIN.SEQUENCES
WHERE increment_by <> 1
·
All sequences with a
positive incremental value. The
values are not assigned cyclically, and there are, at most, only 1000 free
values remaining.
SELECT
owner, sequence_name, last_number, max_value
FROM DOMAIN.SEQUENCES
WHERE increment_by > 0
AND cycle_flag = 'N'
AND max_value - last_number <=
1000
·
Current value of your own
sequence MYSEQ
SELECT last_number
FROM DOMAIN.SEQUENCES
WHERE owner = user
AND sequence_name = 'MYSEQ'
·
Last value assigned by the
current database session to the own sequence MYSEQ
SELECT
user.myseq.currval
FROM DUAL