Anayonkar Shivalkar wrote:In this case, there are several ways (e.g. adding timestamp etc.). I personally would prefer to use a DB sequence in that table.
So, whenever a new row is added, the sequence will be updated (it can be done via query or a trigger on insert), and the program will keep on reading only 'new rows whose sequence id is more than greatest sequence number of last time'.
This will probably work in most cases, but not necessarily in all. It is possible to miss added rows in the described setup.
I've already described the problems with finding out recently added rows several times on the Ranch, for example
here. (It applies to Oracle. Other databases, which support read uncommitted isolation level, might have no problems finding all added rows, but would have problems weeding out rows that were eventually rolled back.)