Archive

Archive for the ‘Flashback Features’ Category

SCN TO Timestamp conversion and Vice Versa

Oracle 10g has new two built-in functions to check the scn of a particular time and vice versa.

these are the two functions

1) Timestamp_to_SCN

2) SCN_to_Timestamp

Examples:
SQL> select timestamp_to_scn(systimestamp) from dual;

TIMESTAMP_TO_SCN(SYSTIMESTAMP)
——————————
                       2880376

SQL> select current_scn from v$database;

CURRENT_SCN
———–
    2880392

SQL> select timestamp_to_scn(’09-JAN-09:12:00:10′) from dual;

TIMESTAMP_TO_SCN(’09-JAN-09:12:00:10′)
————————————–
                               2880066

SQL> select scn_to_timestamp(2880392)from dual;

SCN_TO_TIMESTAMP(2880392)
—————————————————————————
09-JAN-09 12.06.29.000000000 PM

Categories: Flashback Features
Follow

Get every new post delivered to your Inbox.