sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Getting information on an SQL SEQUENCE object

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting information on an SQL SEQUENCE object

    How can I get the current value of an SQL SEQUENCE object, WITHOUT incrementing it with NEXT VALUE FOR first?

    Also, how can I get information about a SEQUENCE, such as min, max, increment value, etc?

  • #2
    There is no way to check the next value, except using the Sequence.
    VALUES NEXT VALUE FOR NAMEOFSEQUENCE.


    But, you can check the last value assigned.
    The easiest way (for me) is to open ACS and check the values in the "Schemas section". Once you are inside one schema, you can browse through the diferent secuences, and check the last assigned value.
    (Sorry, the example is in spanish).


    Another way, as a sequence is a data area, is checking the value with dspdtaara. But I don't recomend it, because the format you can watch isn't clear.


    I'm not sure, but I think it could be possible to check the values using the Catalog tables. In fact, ACS, for sure, obtains the data from there, or one API.



    Answering your second question, you can get the info from ACS as well. Or you can use reverse ingeneering to get the CREATE SEQUENCE with all original definition.
    Or, event better, run this sentence:
    SELECT *FROM QSYS2.SEQUENCES


    I don't know where ACS gets the maximum value for teh sequence, sorry.

    Comment

    Working...
    X