In this article we will discuss how to find SCN from Timestamp and vice versa in ORACLE.
Find SCN From Timestamp
SQL > Col scn for 999999
SQL > select timestamp_to_scn(to_timestamp(‘20-03-2020 17:10:00‘,’DD-MM-YYYY HH24:MI:SS’)) as scn from dual;
Output of the above query will be as below:
SCN
———
921634
Find Timestamp From SCN
SQL > alter session set nls_date_format=’DD-MON-RRRR HH24:MI:SS’;
SQL > select scn_to_timestamp(921634) as timestamp from dual;
Output will be:
TIMESTAMP
—————————————————————————
20-03-2020 17:10:00