I am not aware of a "last assigned sequence" column, nor of what "fixed" would mean for the maximum assigned [MAXASSIGNEDVAL or MAXASNVAL] of an altered SQL sequence. Scripted actions versus /words/ to describe a scenario would IMO, be clearer. No matter about the ALTER, as I have no ability to perform one. However if the maximum value is incremented by the cache value, that would be consistent with an IDENTITY whereby /gaps/ are acceptable and will occur for caching when a situation requires restart with a "safe" value which prevents possibility of duplicates.

The cache value may be in the object, but only the SEQUENCE function is provided to externalize the information, and the SYSSEQUENCES catalog VIEW appears to map all of the data that function generates.

Regards, Chuck

David Gibbs wrote:
CRPence wrote:
If information is required of the SQL sequence, the database
SQL interfaces provided to access details about the sequence
should be utilized & referenced. For example, there is the
SYSSEQ catalog VIEW in QSYS2.

I just realized that the information in the SYSSEQUENCES table
does not actually provide enough information to recreate the
sequence item.

For instance ... if you create a sequence and specify an
increment of 1 that it should cache 10 values ... and use the
sequence once ... the last assigned sequence column will contain
a value 10 times the increment value ... even though the sequence
was only used once. I'm assuming the cached values are stored in
the data area.

Oddly enough ... I noticed that, if you alter the sequence to
turn OFF the cache, the maximum assigned value in the
SYSSEQUENCES table does *not* get fixed ... and the next value
generated by the sequence will be based off the last cached
value.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.