WITH c AS
(SELECT TRUNC (sysdate, 'MM') + ROWNUM - 1 n,rownum
FROM DUAL
CONNECT BY ROWNUM <= (TRUNC (sysdate) - TRUNC (sysdate, 'MM'))+1)
SELECT sum(decode(to_char(n,'D'),7,0,6,0,1)) weekdays
FROM c
(SELECT TRUNC (sysdate, 'MM') + ROWNUM - 1 n,rownum
FROM DUAL
CONNECT BY ROWNUM <= (TRUNC (sysdate) - TRUNC (sysdate, 'MM'))+1)
SELECT sum(decode(to_char(n,'D'),7,0,6,0,1)) weekdays
FROM c
This comment has been removed by the author.
ReplyDelete