select to_char(scn_to_timestamp('4335118084'),'hh24') from dual; 可以取得系统时。10g有效timestamp_to_scn(sysdate)就是系统时间戳了
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production With the Partitioning, OLAP and Data Mining optionsSQL> select to_char(scn_to_timestamp('4335118084'),'hh24') from dual; select to_char(scn_to_timestamp('4335118084'),'hh24') from dual * 第 1 行出现错误: ORA-08181: 指定的编号不是有效的系统更改号 ORA-06512: 在 "SYS.SCN_TO_TIMESTAMP", line 1 ORA-06512: 在 line 1
此类转换需要依赖于数据库内部的数据记录,对于持久的SCN则不能转换,示例如下: SQL> select min(FIRST_CHANGE#) scn,max(FIRST_CHANGE#) scn from v$archived_log;SCN SCN ------------------ ------------------ 8907349093953 8908393582271SQL> select scn_to_timestamp(8907349093953) scn from dual; select scn_to_timestamp(8907349093953) scn from dual * ERROR at line 1: ORA-08181: specified number is not a valid system change number ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1 ORA-06512: at line 1 SQL> select scn_to_timestamp(8908393582271) scn from dual;SCN -------------------------------------------------------- 05-JAN-07 11.45.50.000000000 AM 网上搜索来的,我正在研究
可以取得系统时。10g有效timestamp_to_scn(sysdate)就是系统时间戳了
With the Partitioning, OLAP and Data Mining optionsSQL> select to_char(scn_to_timestamp('4335118084'),'hh24') from dual;
select to_char(scn_to_timestamp('4335118084'),'hh24') from dual
*
第 1 行出现错误:
ORA-08181: 指定的编号不是有效的系统更改号
ORA-06512: 在 "SYS.SCN_TO_TIMESTAMP", line 1
ORA-06512: 在 line 1
SQL> select min(FIRST_CHANGE#) scn,max(FIRST_CHANGE#) scn from v$archived_log;SCN SCN
------------------ ------------------
8907349093953 8908393582271SQL> select scn_to_timestamp(8907349093953) scn from dual;
select scn_to_timestamp(8907349093953) scn from dual
*
ERROR at line 1:
ORA-08181: specified number is not a valid system change number
ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1
ORA-06512: at line 1
SQL> select scn_to_timestamp(8908393582271) scn from dual;SCN
--------------------------------------------------------
05-JAN-07 11.45.50.000000000 AM
网上搜索来的,我正在研究
也就是说如果你的数据库里有个时间戳的纪录,就能转换,没有就转换不了
好像解决不了我的问题。