Monday, May 26, 2008

Select Based on a Date

Since date fields contain minutes and seconds, to match on dates use the function TRUNC . This will strip if down to the month, day and year.

Select Empno, Ename, Job, Hiredate
From Emp
Where Trunc(Hiredate) = Trunc(Sysdate);

EMPNO ENAME JOB HIREDATE
---------- ---------- --------- ---------
1234 MICKEY CEO 26-MAY-08

No comments:

Post a Comment