Increment a sequence twice in DB2 -
I need to get the next value of a sequence twice in DB2 (version 9.1). Instead of performing the following two times:
Select the next equals for the schema. As with the double I would like to do something like this:
Select the next equals for the schema, as IDA, the next draw for the schema Double / Double> in the form of the above only increment, except:
ID1 ID2 ---------- ----------- 643 643 1 record selected Am I forced to query only twice, or is it possible to increase it twice in 1 query? The way?
It's a bit less complicated, but it works (I run it in DB2 v.9 Verify). Choose Generate 1 with AS Sysibm.sysdummy1 UniSesigned with
Generated (Keville), which is generated from the Basic Key + 1) - How many do you want to select INCREMENT_NUMBER as the keyboard, NEXTVAL for schema; Generated from Generated; This is my favorite code, and this is a recursive SQL. You can do this without the sequence object, and it will generate several rows of numbers. Sometimes I use it to insert lines of test-tested data generated.
Comments
Post a Comment