Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle is Catholic!

 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(from dbasupport.com)
create or replace type tabDate as table of date
/

create or replace function dates_in_month (p_month date)
return tabDate
pipelined
is
begin
for i in 0 .. to_number(add_months(p_month,1)-p_month-1)
loop
pipe row (p_month+i);
end loop;
return;
end;
/
select * from table (dates_in_month(to_date('01-oct-1582','DD-mon-YYYY')))
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, for those of us who don't have a copy of Oracle lying around to test this on - what's the result? And is it any different from, say, what you'd get for an equivalent program using java.util.GregorianCalendar?
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I wanted to leave it as an excercise for the reader.

COLUMN_VALUE
------------
10/1/1582
10/2/1582
10/3/1582
10/4/1582
10/15/1582
10/16/1582
10/17/1582
10/18/1582
10/19/1582
10/20/1582
10/21/1582
10/22/1582
10/23/1582
10/24/1582
10/25/1582
10/26/1582
10/27/1582
10/28/1582
10/29/1582
10/30/1582
10/31/1582
21 rows selected
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
found this link too..
http://www.geocities.com/calendopaedia/gregory.htm
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What abt unix :
At command prompt of any Unix ($), type : cal 9 1752
> Surprised???
> See the explanation for what you see. If you are not in Unix don't
> worry:
> see below:
> September 1752
> S M Tu W Th F S
> 1 2 14 15 16
> 17 18 19 20 21 22 23
> 24 25 26 27 28 29 30
> Isn't the output queer? A month with whole eleven days less?
> This was the time England shifted from Roman Julian Calendar to the
Gregorian Calendar, and the king of England ordered those 11 days to be
wiped off the face of the month of September of 1752. (What couldn't a King
do in those
> days?!)
> And yes, the workers worked for 11 days less, but got paid for the entire
30 days. And that's how "Paid Leave" was born. (Bless those people).
>
>
Dont have unix so just believing what is written here.
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup thats what I get with cygwin cal on W2K.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic