oracle中某一时间点scn与时间转化

时间点转成scn

SQL> select timestamp_to_scn('31-OCT-18 01.29.58.000000000 PM') from dual;

TIMESTAMP_TO_SCN('31-OCT-1801.29.58.000000000PM')
-------------------------------------------------
                                          1123574

scn转成时间点

SQL> select to_char(scn_to_timestamp(1123574))from dual;

TO_CHAR(SCN_TO_TIMESTAMP(1123574))
----------------------------------
31-OCT-18 01.29.58.000000000 PM

显示的时间格式好看点

SQL> select to_char(scn_to_timestamp(1123574),'YYYY-MM-DD HH24:MI:SS') from dual;

TO_CHAR(SCN_TO_TIME
-------------------
2018-10-31 13:29:58

猜你喜欢

转载自blog.csdn.net/songyundong1993/article/details/83744525