FIND ALL SATURDAY AND SUNDAY OF YEAR
Example:
DECLARE
ln_year NUMBER := &YEAR;
ld_day DATE;
BEGIN
ld_day := TO_DATE('01-JAN-'||TO_CHAR(ln_year), 'DD-MON-YYYY');
WHILE ld_day < TO_DATE('31-DEC-'||TO_CHAR(ln_year), 'DD-MON-YYYY')
LOOP
IF TO_CHAR(ld_day, 'D') IN (1,7) THEN
dbms_output.put_line(TO_CHAR(ld_day));
END IF;
ld_day := ld_day + 1;
END LOOP;
END;
/
Example:
DECLARE
ln_year NUMBER := &YEAR;
ld_day DATE;
BEGIN
ld_day := TO_DATE('01-JAN-'||TO_CHAR(ln_year), 'DD-MON-YYYY');
WHILE ld_day < TO_DATE('31-DEC-'||TO_CHAR(ln_year), 'DD-MON-YYYY')
LOOP
IF TO_CHAR(ld_day, 'D') IN (1,7) THEN
dbms_output.put_line(TO_CHAR(ld_day));
END IF;
ld_day := ld_day + 1;
END LOOP;
END;
/
No comments:
Post a Comment