You are here

Tom Kyte is Excited!

Tom Kyte is working on a series of articles about the new features in Oracle 12c/18c (cloud).  One of the most exciting?  Timeline-based queries.  Tom says:

Oracle 9i exposed flashback query to developers for the first time.  The ability to flashback query dates back to version 4 however (it just wasn't exposed).  Every time you run a query in Oracle it is in fact a flashback query - it is what multi-versioning is all about.

What does that mean for you?  That means you can take any date range-based query and have the range checks automatically computed by SQL*Plus.  This transforms a nasty query like this:

SELECT USERNAME, FULLNAME
FROM USER_ACCOUNT_HISTORY
WHERE CREATED_DATE >= SYSDATE - 7
AND (TERMINATED_DATE IS NULL OR TERMINATED_DATE >= SYSDATE - 7);

To a nice, clean:

SELECT USERNAME, FULLNAME
FROM USER_ACCOUNT_HISTORY
AS OF PERIOD FOR VALID SYSDATE - 7;

Not that these queries are the best example, but hopefully you can come up with your own.  Please feel free to share, we always love comments here.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer