Temporal tables in Oracle

前提是你 提交于 2021-02-19 03:35:29

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/21139448/temporal-tables-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!