Use of the ORA_ROWSCN pseudo Column

Source: Internet
Author: User

Ora_rowscn

For each row of data, ora_rowscn returns the approximate time that each row was last modified. this is useful for determining when a row of data is modified. because Oracle uses transaction commit to track the data blocks of rows for scn, it is not accurate. you can use the row-level dependency trace when creating a table to obtain a more precise scn. create table... norowdependencies | rowdependencies

You cannot use ora_rowscn when querying a view. However, you can use ora_rowscn for the base table of the view.

You can also use ora_rowscn in the where clause of the update or delete statement.

Ora_rowscn cannot be used for flash-back queries, but it can be used to replace ora_rowscn.

Ora_rowscn cannot be used for external tables.

Obtain the scn of the root of the modified row.

SQL> select ora_rowscn, t. test_id from test_jy t;

ORA_ROWSCN TEST_ID

-------------------------------

625591 3

Obtain the approximate modification time of the row record through scn

SQL> select scn_to_timestamp (ora_rowscn), t. test_id from test_jy t;

SCN_TO_TIMESTAMP (ORA_ROWSCN) TEST_ID

-----------------------------------------------------------------------------------------------------

20-12-12 06.23.22.20.00000 3 pm

You can also obtain the scn through time.

SQL> select timestamp_to_scn (scn_to_timestamp (ora_rowscn), t. test_id from test_jy t;

TIMESTAMP_TO_SCN (SCN_TO_TIMEST TEST_ID

---------------------------------------------------

625590 3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.