Look up a "sequence" object. Under the covers it's a data area.
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzsequences.htm
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzseqref.htm

If, however, you just HAVE to have it in a table, you may wish to try
something else. Hmm, there's an option to do something like you want for
INSERTs but UPDATEs are a different animal.
For example I can do
select seqnbr
from final table (insert into qtemp/xxx (SEQTYPE, SEQNBR
VALUES ('A', 1))
You may not see the use here, but for special values on an insert like
identity columns, current timestamp, etc, you would.
But I can't figure out how to do
select seqnbr
from final table (update qtemp/xxx set seqnbr+=1
where seqtype='A')
SQL0199-Keyword UPDATE not expected. Valid tokens: INSERT.



Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.