In Oracle, you can simply subtract two dates and get the difference in days. Also note that unlike SQL Server or MySQL, in Oracle you cannot perform a select
statement without a from
clause. One way around this is to use the builtin dummy table, dual
:
SELECT TO_DATE('2000-01-02', 'YYYY-MM-DD') -
TO_DATE('2000-01-01', 'YYYY-MM-DD') AS DateDiff
FROM dual
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…