10 окт. 2014 г.

on Leave a Comment

How to convert SCN to DATE and DATE to SCN

Sometimes it is very needed to convert SCN to DATE or DATE to SCN, so now I will tell you how to do it:
Get current SCN:
SQL> select current_scn from v$database;

7597825059

Convert SCN to DATE:
SQL> select scn_to_timestamp(7597825059) as timestamp from dual;

10-OCT-14 01.36.28.000000000 PM

Convert DATE TO SCN:
SQL> select timestamp_to_scn(to_timestamp('10/10/2014 10:24:54','DD/MM/YYYY HH24:MI:SS')) as scn from dual; 

7597430601

0 коммент.:

Отправить комментарий

Технологии Blogger.