-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I request the next value of a sequence via Java? #237
Comments
Can you provide a code snippet that explains your problem better? |
I just want to retrieve the next value in the sequence and I only find examples like this in the IBM documentation:
which doesn't work for me Note: ORDER_SEQ is de name of sequence |
I would also like to know if there is a query in SQL that allows me to verify the existence of a sequence in the system. I have not found any way to do so other than through the database itself. |
Create the sequence
CREATE SEQUENCE ORDER_SEQ
START WITH 500
INCREMENT BY 1
MAXVALUE 10000
NOCYCLE
CACHE 24 Increment the sequenceselect (next value for order_seq) from qcllesrc limit 1 -- any table Get the last used incrementselect (previous value for order_seq) from qcllesrc limit 1 -- any table |
@wimjongman Thank you very much Another question, do you know where IBM I keeps track of this sequence? Is there a table that can be consulted? |
|
I guess it's not queryable via SQL then, I've been doing this for a short time and I'm really not sure what implications a data area has with respect to a file, thank you very much anyway |
Sorry, you can get it though the https://www.ibm.com/docs/en/i/7.5?topic=services-object-statistics-table-function |
Hello, I wanted to know if there is a way to request the value of a sequence through a query, since I tried "values nextval for name_seq" as I would do through the interface and it does not recover the value, and the documentation only mentions methods to embed it within an INSERT, and I have a use case in which I need to bring the value to my program to do something with it beforehand.
The text was updated successfully, but these errors were encountered: