[ad_1]
In Oracle, SYSDATE
is a function that returns both date and time component. Difference of two DATE
datatype values returns number of days between them. Therefore, as SYSDATE
also contains hours, minutes and seconds, you’ll almost always get a decimal number as the result (unless you run that piece of code at midnight).
Therefore, I presume that you’d – actually – want to truncate SYSDATE
which then “removes” time component (sets it to 00:00:00):
SQL> select SYSDATE - TO_DATE('30-12-1899','dd-mm-yyyy') from dual;
SYSDATE-TO_DATE('30-12-1899','DD-MM-YYYY')
------------------------------------------
44715.3208
SQL> select trunc(SYSDATE) - TO_DATE('30-12-1899','dd-mm-yyyy') from dual;
TRUNC(SYSDATE)-TO_DATE('30-12-1899','DD-MM-YYYY')
-------------------------------------------------
44715
SQL>
[ad_2]