Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Has Oracle actually erased the birth of Christ from the calendar?

Has Oracle actually erased the birth of Christ from the calendar?

From: Chris O'Sullivan <itoys_at_tpg.com.au>
Date: Fri, 9 Nov 2001 23:00:56 +1000
Message-ID: <3bebc631@dnews.tpgi.com.au>


This seems like an interesting bug. It was around in 8.1.5. I've just checked 8.1.6 and same again. What do all you SQL gurus think?

Look at this log from a SQL*Plus session and tell me I've got it wrong. The way I see it there is a serious calculation problem with dates that span the birth of Christ.



SQL*Plus: Release 8.1.6.0.0 - Production on Fri Nov 9 22:23:33 2001

(c) Copyright 1999 Oracle Corporation. All rights reserved.

Connected to:
Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production With the Partitioning option
JServer Release 8.1.6.0.0 - Production

SQL> select to_char(to_date('1721423','j'),'syyyy/mm/dd') from dual select to_char(to_date('1721423','j'),'syyyy/mm/dd') from dual

                        *

ERROR at line 1:
ORA-01841: (full) year must be between -4713 and +9999, and not be 0

SQL> c /23/24/
  1* select to_char(to_date('1721424','j'),'syyyy/mm/dd') from dual SQL> / TO_CHAR(TO_



 0001/01/01

SQL> select to_char(to_date('-0001/12/31','syyyy/mm/dd'),'j') from dual;

TO_CHAR



1721057

SQL> select to_char(to_date('1721058','j'),'syyyy/mm/dd') from dual; select to_char(to_date('1721058','j'),'syyyy/mm/dd') from dual

                        *

ERROR at line 1:
ORA-01841: (full) year must be between -4713 and +9999, and not be 0

SQL> ed
Wrote file afiedt.buf

  1* select to_char(to_date('-0001/12/31','syyyy/mm/dd') +0,'j, syyyy/mm/dd') from dual
SQL> / TO_CHAR(TO_DATE('-00



1721057, -0001/12/31

SQL> c /+0/+1/
  1* select to_char(to_date('-0001/12/31','syyyy/mm/dd') +1,'j, syyyy/mm/dd') from dual
SQL> / TO_CHAR(TO_DATE('-00



0000000, 00000/00/00

SQL> c /+1/+366/
  1* select to_char(to_date('-0001/12/31','syyyy/mm/dd') +366,'j, syyyy/mm/dd') from dual
SQL> / TO_CHAR(TO_DATE('-00



0000000, 00000/00/00

SQL> c /+366/+367/
  1* select to_char(to_date('-0001/12/31','syyyy/mm/dd') +367,'j, syyyy/mm/dd') from dual
SQL> / TO_CHAR(TO_DATE('-00



1721424, 0001/01/01

When pope Gregory adjusted 10 days from the calendar in October 1582 they say that there were riots because people at the time believed that they were being robbed of 10 days off of their lives. What would they have done if they had found that Oracle has robbed all of us of a year [well if we were living at the time of Christ].

This begs the question:

Is Larry really God? If pope Gregory struggled to get away with 10 days guess you would have to be God to get away with 367 days! Received on Fri Nov 09 2001 - 07:00:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US