Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Need a DATE script that produces....
Use the following PL/SQL program to get the dates list you need.
declare
cur_date Date := to_date('31-DEC-1998', 'DD-MON-YYYY');
end_date Date := to_date('31-DEC-1999', 'DD-MON-YYYY');
Begin
DBMS_OUTPUT.PUT_LINE('Monday Friday ');
DBMS_OUTPUT.PUT_LINE('------------------------'); Loop Select Next_Day(Cur_Date, 'MONDAY') into Cur_Date from Dual; Exit When Cur_Date > End_Date; DBMS_OUTPUT.PUT_LINE(To_Char(Cur_Date, 'DD-MON-YYYY') ||' ' ||To_Char(Cur_Date + 4, 'DD-MON-YYYY'));
Suresh
Jenny Farnham wrote:
> I need a sql*plus script that will produce these results
> for a calendar year of 1999. I need the first day of the
> business week (Monday) and the last day of the week (Friday).
> I could create a table/view and hand load these in, but was
> wondering if anyone could come up with a script to generate
> these dates using sql*plus.
>
> If you create it, could you post it here? or give URL for the
> web site of where we could download it? Thanks!
>
> First Day of Week Last Day of Week
> ----------------- -----------------
> 04-JAN-1999 08-JAN-1999
> 11-JAN-1999 15-JAN-1999
> 18-JAN-1999 22-JAN-1999
> 25-JAN-1999 29-JAN-1999
> 01-FEB-1999 05-FEB-1999
> 08-FEB-1999 12-FEB-1999
Received on Thu Feb 18 1999 - 22:15:25 CST