I need to get the next value of a sequence twice in DB2 (version 9.1). Rather than executing the following twice:
SELECT nextval FOR schema.sequence AS id
FROM dual
I would like to do something like:
SELECT nextval FOR schema.sequence AS id1,
nextval FOR schema.sequence AS id2
FROM dual
Except the above only increments it once:
ID1 ID2
----------- -----------
643 643
1 record(s) selected.
Am I forced to just query twice, or is there a way to increment it twice in 1 query?