database Oracle 中表行的创建日期时间是多少?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6571575/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the created Date-time for Table row in Oracle?
提问by Amr Badawy
Yesterday my friend -BI Specialist - explained me an oracle problem :
there's an oracle database that contain huge amount of data but they don't make column for each table that store Created datetime for each row.
So in this case How can he get Created datetime (timestamp) for each row ?
昨天我的朋友 - BI 专家 - 向我解释了一个 oracle 问题:
有一个包含大量数据的 oracle 数据库,但他们没有为每个表创建列来存储每行的创建日期时间。
那么在这种情况下,他如何为每一行获取创建日期时间(时间戳)?
回答by CristiC
Every row has its own System Change Number (SCN). This is identifying precisely a moment in the database.
每行都有自己的系统更改号 (SCN)。这正是在数据库中识别一个时刻。
First find out the SCN and based on it use SCN_TO_TIMESTAMP to get the time-stamp:
首先找出 SCN 并基于它使用 SCN_TO_TIMESTAMP 获取时间戳:
SELECT
SCN_TO_TIMESTAMP(ora_rowscn),
MyTable.*
FROM
MyTable

