Hi All,
I have to return the days of the week in between given two days. (i.e. given MONDAY and THURSDAY, it must return TUESDAY and WEDNESDAY). This assumes start of the week is SUNDAY. Can this be done thru SQL?
Thanks,
skid
Printable View
Hi All,
I have to return the days of the week in between given two days. (i.e. given MONDAY and THURSDAY, it must return TUESDAY and WEDNESDAY). This assumes start of the week is SUNDAY. Can this be done thru SQL?
Thanks,
skid
I modified the query by balajiyes from the dates retreival thread. It works fine, but if you input the same v_from and v_to date, it returns all the dates.
Code:select TO_CHAR(x.date_val,'DAY')
from
(
select TRUNC(sysdate,'YYYY')+ROWNUM -1 as date_val,
TO_CHAR(TRUNC(sysdate,'YYYY')+ROWNUM -1,'YYYYMM') as year_month,
TO_CHAR(TRUNC(sysdate,'YYYY')+ROWNUM -1,'DD') as day,
ROWNUM
FROM all_objects
WHERE TRUNC(sysdate,'YYYY')+ROWNUM -1 < ADD_MONTHS(TRUNC(sysdate,'YYYY'),12)
) x
where year_month = to_number(to_char(sysdate,'YYYYMM'))
and X.date_val BETWEEN next_day(trunc(sysdate,'MONTH'),'&from_day') AND next_day(next_day(trunc(sysdate,'MONTH'),'&from_day'),'&from_to')
/