Search code examples
mysqloracle-databaserdbms

Is it possible to read records from a MySQL or Oracle Server which were created after a specific Timestamp, even if there is no Timestamp column?


I have to read from a remote MySQL server periodically.Say if the table does not have a timestamp column,is there a way to keep track of the rows which i already read.I only need to read the rows which were created after my last access.


Solution

  • One way, if the tables are in Oracle, would be to enable flashback queries and then you could do:

    SELECT *
    FROM   your_table t
    WHERE  NOT EXISTS (
      SELECT 1
      FROM   your_table AS OF TIMESTAMP SYSTIMESTAMP - INTERVAL '10' MINUTE x
      WHERE  t.primary_key_column = x.primary_key_column
    );