Year Date's and days come in form [message #409805] |
Wed, 24 June 2009 02:46 |
shahzaib_4vip@hotmail.com
Messages: 410 Registered: December 2008 Location: karachi
|
Senior Member |
|
|
Dear all
I have 2 Column 1 is Date and 2nd is Day
And i have one Button i need when i enter button then its show all year date in date column and day in day column for example
Date---------Day
1-jan-2009-Thursday
2-jan-2009-Friday
3-jan-2009-Saturday
And As on
I hope you guys understand
Regards
Shahzaib ismail
|
|
|
|
Re: Year Date's and days come in form [message #410089 is a reply to message #409805] |
Thu, 25 June 2009 03:03 |
shahzaib_4vip@hotmail.com
Messages: 410 Registered: December 2008 Location: karachi
|
Senior Member |
|
|
DECLARE
Dt_Date DATE;
BEGIN
GO_BLOCK ('block3');
CLEAR_BLOCK(NO_VALIDATE);
FIRST_RECORD;
Dt_Date := TO_DATE('01-JAN-2009');
LOOP
:block3.ok := TO_CHAR(Dt_Date, 'DD-MON-YYYY');
:block3.DAY := TO_CHAR(Dt_Date, 'DAY');
EXIT WHEN TO_CHAR(Dt_Date, 'YYYY') <> TO_CHAR(dt_date + 1, 'YYYY'); -- If next year reaches, exit from the loop.
Dt_Date := Dt_Date + 1;
NEXT_RECORD;
END LOOP;
END;
This is my code and its work Perfectly
Regards
Shahzaib ismail
|
|
|
Re: Year Date's and days come in form [message #410093 is a reply to message #410089] |
Thu, 25 June 2009 03:20 |
nagu_bhat
Messages: 10 Registered: May 2009
|
Junior Member |
|
|
Hi
here is a simpler code for u
select to_char(trunc(sysdate,'YYYY') + level -1,'DD-MON-YYYY') ok,
to_char(trunc(sysdate,'YYYY') + level -1,'DAY') day
from dual
connect by level <= ((add_months(trunc(sysdate,'YYYY'),12)-1) -
trunc(sysdate,'YYYY'))
/
you can even put this is the block using from clause query.
Regards
Nagaraj
|
|
|