DB2 FIND LAST RECORD INSERTED

DB2 FIND LAST RECORD INSERTED

 

  

To All,
The following code can be used to find the last record inserted (not
updated or deleted) into a table (I don't work if this works for a cluster,
partition, etc but it works for a "normal" table).

SELECT DEPTNO, DNAME
FROM DEDBADM.DEPT
ORDER BY DEPTNO DESC
FETCH FIRST 1 ROWS ONLY;



DB2 & UDB email list listserv db2-l LazyDBA home page