Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Checking for existence [newbie]
I have to find out the existence of tasks
for an employee, and for a time period.
Now I do
SELECT COUNT(*)
FROM TASKS
WHERE EMPNO = 239 AND
TASK_DATE >= SYSDATE-4 AND
TASK_DATE <= SYSDATE-1;
If COUNT(*) gives value greater than 0,
then I know that that employee had some tasks
in the given time period. However is there
a better trick? Function COUNT(*) is too
slow and I have to find just ONE row.
Received on Thu May 15 2003 - 17:27:52 CDT