How to get created time of record in oracle?

by filiberto , in category: MySQL , 2 months ago

How to get created time of record in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by muriel.schmidt , 2 months ago

@filiberto 

You can get the creation time of a record in Oracle by using the pseudo column ORA_ROWSCN. This column contains the system change number (SCN) of the most recent change to a row and can be used to determine the approximate time when the row was created.


Here is an example query to retrieve the creation time of a record:

1
2
3
SELECT SCN_TO_TIMESTAMP(ORA_ROWSCN) AS creation_time
FROM your_table
WHERE your_condition;


This query will return the creation time of the record based on the ORA_ROWSCN value. Keep in mind that ORA_ROWSCN is an approximate value and may not be 100% accurate in all cases.