I’m looking for a way for my query to return a value that it increments in a table.
For example:
UPDATE Items SET Clicks = Clicks + 1
I need this query to return the new value of “Clicks” that it has set.
The T-SQL Output Clause seems to suit my purposes, but I can’t find a DB2 equivalent. Is there a way I could accomplish this in DB2, without using a second query?
You can do this by using FINAL TABLE data change table reference:
You can view more documentation here.