ORA_ROWSCN伪列的用途

2014-11-24 18:21:26 · 作者: · 浏览: 0

ora_rowscn


在对视图进行查询时不能使用ora_rowscn.但对于视图的基表是可以使用ora_rowscn.


也能在update或delete语句中的where子句中使用ora_rowscn


ora_rowscn不能用于回闪查询,但是可以用回闪版本查询来代替ora_rowscn.


ora_rowscn也不能用于外部表


获取行被修改的大根的scn


SQL> select ora_rowscn,t.test_id from test_jy t;


ORA_ROWSCN TEST_ID


---------- ---------------------


625591 3


通过scn来获取修改行记录大概的时间


SQL> select scn_to_timestamp(ora_rowscn),t.test_id from test_jy t;


SCN_TO_TIMESTAMP(ORA_ROWSCN) TEST_ID


-------------------------------------------------------------------------------- ---------------------


20-12月-12 06.23.22.000000000 下午 3


也可以通过时间来获得scn


SQL> select timestamp_to_scn(scn_to_timestamp(ora_rowscn)),t.test_id from test_jy t;


TIMESTAMP_TO_SCN(SCN_TO_TIMEST TEST_ID


------------------------------ ---------------------


625590 3