Oracle , , TRUNC (SYSDATE) + 1 .
, :
1) (, SYSDATE)
2) , ,
3) SYSDATE .
, ( dt )
TO_DATE(
TRUNC(SYSDATE) - ROUND(AVG(TRUNC(SYSDATE) - TRUNC(dt)))
)
According to some exemplary data, this was done a little less than half the time of Dan A.'s approach above and produced the same result. I only checked it for data with dates in the past, but I see no obvious reason that it will not generalize (the last known words when working with DATETIME data, I understand ...)
source
share