|
|
|
|
|
Re: To display cosecutive 50 month dates using For loop [message #266703 is a reply to message #266690] |
Tue, 11 September 2007 08:08 |
|
Soumen Kamilya
Messages: 128 Registered: August 2007 Location: Kolkata
|
Senior Member |
|
|
May be you need this code:
DECLARE
Counter NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE('WELCOME TO MY CALENDER!');
FOR c1 IN (SELECT LEVEL,
Add_months(To_date('01/01/'
||'2007','dd/mm/yyyy'),LEVEL - 1) AS Months
FROM Dual
CONNECT BY LEVEL <= 50)
LOOP
DECLARE
CURSOR c2(Months IN DATE) IS
SELECT LEVEL
FROM Dual
CONNECT BY LEVEL <= To_char(Last_day(Months),'dd');
CURSOR c4(Dates IN DATE) IS
SELECT To_char(To_date('01/'
||To_char(Dates,'mm/yyyy'),'dd/mm/yyyy') + LEVEL - 1,
'Dy') AS Days
FROM Dual
CONNECT BY LEVEL <= 7;
BEGIN
dbms_Output.Put_Line(NULL);
dbms_Output.Put_Line('Month No : '||lPad(c1.LEVEL,2,'0')||' is : '||To_Char(c1.Months,'Mon-yyyy'));
Counter := 0;
FOR c5 IN c4(c1.Months) LOOP
dbms_Output.Put(c5.Days
||' ');
END LOOP;
dbms_Output.Put_Line(NULL);
FOR c3 IN c2(c1.Months) LOOP
Counter := Counter + 1;
IF mod(Counter,7) = 0 THEN
dbms_Output.Put_Line(c3.LEVEL);
ELSE
dbms_Output.Put(c3.LEVEL||' ');
END IF;
END LOOP;
END;
dbms_Output.Put_Line(NULL);
END LOOP;
END;
Cheers
Soumen
|
|
|
|
|
|
|
Re: To display cosecutive 50 month dates using For loop [message #267029 is a reply to message #267027] |
Wed, 12 September 2007 05:16 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
You seem to have an erroneous picture of the purpose of this site. It is not a requesting place for queries, you can get help here solving troubles you have.
In order to really help you, we like you to show us what you tried and where you are stuck. Providing you with a query, you may not even understand, well, we don't consider that really as helping.
|
|
|
|