***List of all SUNDAYS in a year by query***
(1).
with dts AS
(
SELECT DATE'2023-01-01'+ROWNUM-1 dt
FROM dual
CONNECT BY LEVEL <= 366 )
SELECT *
FROM dts
WHERE to_char(dt, 'fmday', 'NLS_DATE_LANGUAGE=AMERICAN') = 'sunday';
(2).
SELECT dates, day
FROM (
SELECT ROWNUM,
Trunc(SYSDATE,'YEAR')+ROWNUM-1 dates,
To_char(Trunc(SYSDATE,'YEAR')+ROWNUM-1,'DAY') day
FROM user_objects or_any_table_that_will_exceed_365_rows
WHERE ROWNUM-1 < 365 )
WHERE day LIKE 'SUNDAY%';
No comments:
Post a Comment