我有一个oracle数据库,它存储一些字符串值的历史记录。我有以下列:ID
,VALIDFROM
,VALIDTO
,VALUE
。这里,VALIDFROM
和VALIDTO
的类型为TIMESTAMP(6),VALUE
是一个字符串。这个想法是VALIDTO
为空表示这是"最新的"版本,并且所有以前的版本都与它们当前的时间段一起存储。
我有一个问题,即VALIDFROM
和VALIDTO
百分之一秒之间存在微小的差异。差异各不相同,但总是积极的,几乎总是不到一秒钟。 "更新"程序从C#调用,如下所示:
PROCEDURE UpdateEntity(p_ID IN OTHERTABLE.ID%TYPE,
p_value IN TABLENAME.VALUE%TYPE,
p_newParamDate OUT TABLENAME.VALIDFROM%TYPE)
IS
BEGIN
p_newParamDate := SYSTIMESTAMP;
RemoveParams( p_ID, p_newParamDate );
InsertNewParamValues(p_ID, p_value, p_newParamDate);
END;
然后在RemoveParams
内我们有:
UPDATE TABLENAME
SET VALIDTO = p_newParamDate
WHERE ID = p_ID
AND VALIDTO IS NULL;
并在InsertNewParamValues中:
INSERT INTO TABLENAME
(ID, VALIDFROM, VALIDTO, VALUE )
VALUES (p_ID, p_newParamDate, NULL, p_value)
任何可能导致这种微小差异的想法?谢谢!
Exerpt:
VALIDFROM VALIDTO
27-OCT-17 12.05.45.028689000 AM
27-OCT-17 12.05.35.220583000 AM 27-OCT-17 12.05.45.018581000 AM
26-OCT-17 11.35.57.247651000 PM 27-OCT-17 12.05.35.203858000 AM
26-OCT-17 11.35.49.299807000 PM 26-OCT-17 11.35.57.233538000 PM
26-OCT-17 11.34.21.635409000 PM 26-OCT-17 11.35.49.290447000 PM
26-OCT-17 11.32.54.625407000 PM 26-OCT-17 11.34.21.623951000 PM
26-OCT-17 11.32.46.273930000 PM 26-OCT-17 11.32.54.615400000 PM
26-OCT-17 11.04.40.897067000 PM 26-OCT-17 11.32.46.248630000 PM
26-OCT-17 11.04.32.784997000 PM 26-OCT-17 11.04.40.888333000 PM
26-OCT-17 10.59.15.844527000 PM 26-OCT-17 11.04.32.772275000 PM
26-OCT-17 10.59.07.163012000 PM 26-OCT-17 10.59.15.833788000 PM
26-OCT-17 10.35.23.634316000 PM 26-OCT-17 10.59.07.149803000 PM