工作需要使用一下闪回查询,这一块以前没有接触过,查了一下ORACLE的SQL Language Reference文档,了解了一下,做了个测试,记录如下,使用scott用户。
1.检查一下当前的timestamp
sql>select
systimestamp from dual;
SYSTIMESTAMP
---------------------------------------------------------------------------
16-APR-14 09.12.13.366706 AM +08:00
2.选取准备测试数据
sql>select sal from emp where ename='SMITH';
SAL
----------
800
3.更新指定数据
sql> update emp set sal=1000 where ename='SMITH';
sql> select sal from emp where ename='SMITH';
SAL
----------
1000
4.检查指定timestamp时表的情况。关键在as of timestamp子句。
sql>select sal from emp as of timestamp(to_timestamp('16-APR-14 09.12.13.366706','DD-Mon-RR HH24:MI:SS.FF')) where ename='SMITH';
SAL
----------
800
5.检查相对当前timestamp提前1分钟时表的情况。
sql>select sal from emp as of timestamp (systimestamp -interval '1' minute) where ename='SMITH';
SAL
----------
800
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8441448/viewspace-1143642/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8441448/viewspace-1143642/