Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To use DateDiff calculation in Oracle's WHERE clause, you can use the following syntax:

SELECT * FROM tablename WHERE DATEDIFF('interval', date1, date2) = value;

Here, the 'interval' specifies the time unit such as day, hour, minute, etc. that you want to calculate the difference in. 'date1' and 'date2' are the two dates between which the difference needs to be calculated. 'value' is the numerical value that you are comparing the difference to.

For example, if you want to find all the records where the difference between the 'created_date' and the current date is greater than 30 days, you can use the following query:

SELECT * FROM tablename WHERE DATEDIFF('day', created_date, sysdate) > 30;

This will return all the records where the difference between the 'created_date' and the current date is greater than 30 days.