Вопрос

Tom Kyte describes temporal tables here:

temporal tables are tables that can return the answer that existed at a point in time -- you can ask the table to return the answer that existed at midnight last night, instead of the answer that exists right now

Do such tables exist in Oracle? I can't find documentation of them. How can I create one and use it? He says they exist in databases, although he doesn't say that they do in Oracle nor any other product. Is this a conceptual thing not implemented?

Это было полезно?

Решение

Well, I believe you mean to get the data state as it was some time earlier than now. In this case Oracle suggests FLASHBACK QUERIES:

SQL> select * from t where x in (1,2,3);

         X          Y                                                           
---------- ----------                                                           
         1          1                                                           
         2          2                                                           
         3          3                                                           

SQL> delete from t where x in (1,2,3);

SQL> commit;

SQL> select * from t where x in (1,2,3);

No rows selected

SQL> select * from t as of timestamp(systimestamp - interval '2' minute) where x in (1,2,3)
  2  /

         X          Y                                                           
---------- ----------                                                           
         1          1                                                           
         2          2                                                           
         3          3                                                           

Oracle describes this option there

http://docs.oracle.com/cd/B12037_01/appdev.101/b10795/adfns_fl.htm#1008580

As of temporary tables - plese see this reference:

http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables003.htm#ADMIN01503

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top