I am using iseries for DB2.I want to get the latest value for a column in Db2.? I tried using IDENTITY_VAL_LOCAL() but this needs an insert statement.In my case I don't perform any insertion. I want latest value inserted in a column in Db2, which is necessarily not recently inserted.
Do you have a timestamp field on your table? You could do something like:
SELECT id
FROM schema.table
ORDER BY tstamp DESC
FETCH FIRST ROW ONLY
If you don't, I'm not sure how you plan on defining "latest" (since you said in the other answer's comments that this is an alpha-numeric field that isn't necessarily in "order").