COMPARE TIMESTAMP WITH SYSDATE in ORACLE

Some times we will be needed to compareTIMESTAMP with SYSDATE.

Below is the query which will demonstrate the same.

The query below calculates the count of employees joined today based on Employee joined date.


SELECT COUNT(*) AS TOTAL FROM EMPLOYEE EMP
 WHERE
 EMP.JOINEDDATE > TO_DATE(TO_CHAR(SYSDATE-1,'DD-MON-YYYY'),'DD-MON-YYYY')
 AND EMP.JOINEDDATE < TO_DATE(TO_CHAR(SYSDATE,'DD-MON-YYYY'),'DD-MON-YYYY');

No comments:

Post a Comment