Select SUM(decode(TRIM(day_name),'SATURDAY',0,'SUNDAY',0,1))
FROM
(SELECT (LEVEL) day_nr,(LEVEL + TRUNC(SYSDATE, 'MONTH') - 1) day_date,
TO_CHAR(LEVEL + TRUNC(SYSDATE, 'MONTH') - 1, 'DAY','NLS_DATE_LANGUAGE=ENGLISH') AS day_name
FROM DUAL
CONNECT BY LEVEL <= ADD_MONTHS(TRUNC(SYSDATE, 'MONTH'), 1) - TRUNC(SYSDATE, 'MONTH')
ORDER BY day_nr)
No comments:
Post a Comment