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

Advertisements

One thought on “SCN TO Timestamp conversion and Vice Versa

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s