Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Selecting from Calendar ??
Hi all,
I have a Calendars table ... where we save month_start and month_end date. The start/end dates of these months have no relationship with actual months in Normal (Gregorian) calendars.
What I need is a list of month_num, month_start and month_end dates when I provide a start and end date.
The table structure is table_cal (year, month, month_start, month_end), for the same of simplicity let's assume this table contains gregorian calendar.
e.g. (based on gregorian calendar_ when I enter 01-15-2000 to 05-10-2000
Expected Result
YEAR MONTH START END
2000 1 01-01-2000 01-31-2000 2000 2 02-01-2000 02-29-2000 2000 3 03-01-2000 03-31-2000 2000 4 04-01-2000 04-30-2000 2000 5 05-01-2000 05-31-2000
BTW I can't make use of LAST_DAY or FIRST_DAY as the start /end dates for our months are different from those of Gregorian Calendar months. We use Broadcast calendars, where a month ends on the last sunday e.g. Jun 2000 is May29 - Jun25 and Jul 2000 is Jun26 - Jul30. I have been trying to get this in SQL for a day, but no avail ... I know this can be done in pl/sql, but if I could do this in SQL, it would help as lots of processing needs to be done based on this logic.
Your help is greatly appreciated
TIA
Raj
![]() |
![]() |