Artem Zubkov
Artem Zubkov

Reputation: 559

How to select the last inserted records in a table in Oracle

I know that have operator VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE, but it's don't work correct. Query

SELECT VERSIONS_ENDTIME, VERSIONS_OPERATION FROM mytable VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE

return empty feilds: VERSIONS_ENDTIME and VERSIONS_OPERATION.

enter image description here

Maybe have another methods for select the last inserted records in a table from the last week?

Upvotes: 2

Views: 1824

Answers (1)

Erkan Haspulat
Erkan Haspulat

Reputation: 12572

You can try to use Flashback Queries, but this kind of approach is not feasible for a production system. This approach should be used for recovery or administrational queries.

Under normal circumstances, you should have some other kind of method for detecting when a row was inserted, for example you can add a date column in your table and populate it with SYSDATE on each insert.

Upvotes: 2

Related Questions