[bug?] weird things with date'0000-00-00'

"xenon325" <[email protected]>
Newsgroups gmane.comp.db.oracle.toad.free
Message-ID <[email protected]>
'0000-00-00' date is shown as '0001-01-01'

Test case:

-----------------------------------------------------

create table anm_tmp ( id integer, d DATE );

begin
   delete anm_tmp;

   insert into anm_tmp values( 1, date'0001-01-01');
   insert into anm_tmp values( 2, date'0001-01-01' - 1 );
   insert into anm_tmp values( 3, date'0001-01-01' - 366 );
   insert into anm_tmp values( 4, date'0001-01-01' - 367 );
   insert into anm_tmp values( 5, date'0001-01-01' - 368 );
   insert into anm_tmp values( 6, TO_DATE( 1, 'J') );
   insert into anm_tmp values( 7, TO_DATE( 1, 'J') + 1721423 );
   insert into anm_tmp values( 8, TO_DATE( 1, 'J') + 1721422 );
   insert into anm_tmp values( 9, TO_DATE( 1, 'J') + 1721421 );
   
   commit;
end;

SELECT t.*, to_char(t.d, 'YYYY.MM.DD AD HH24:MI:SS'), to_char(t.d, 'J')
  FROM anm_tmp t
 ORDER BY 1  
;

-----------------------------------------------------

TOAD output: 
id      d                to_char(d, 'YYYY.MM.DD...    to_char(d, 'J')
1	01.01.0001	0001.01.01 AD 00:00:00	        1721424
2	01.01.0001	0000.00.00 0000000 00:00:00	0000000
3	01.01.0001	0000.00.00 0000000 00:00:00	0000000
4	31.12.0001	0001.12.31 BC 00:00:00	        1721057
5	30.12.0001	0001.12.30 BC 00:00:00	        1721056
6	01.01.4712	4712.01.01 BC 00:00:00	        0000001
7	01.01.0001	0001.01.01 AD 00:00:00	        1721424
8	01.01.0001	0000.00.00 0000000 00:00:00	0000000
9	01.01.0001	0000.00.00 0000000 00:00:00	0000000


SQL*Plus output:

        ID D        TO_CHAR(T.D,'YYYY.MM.DDADHH TO_CHAR
---------- -------- --------------------------- -------
         1 01.01.01 0001.01.01 &#205;.&#199;. 00:00:00    1721424
         2 31.12.00 0000.00.00 0000000 00:00:00 0000000
         3 01.01.00 0000.00.00 0000000 00:00:00 0000000
         4 31.12.01 0001.12.31 &#196;&#206; &#205;.&#199;. 00:00:00 1721057
         5 30.12.01 0001.12.30 &#196;&#206; &#205;.&#199;. 00:00:00 1721056
         6 01.01.12 4712.01.01 &#196;&#206; &#205;.&#199;. 00:00:00 0000001
         7 01.01.01 0001.01.01 &#205;.&#199;. 00:00:00    1721424
         8 31.12.00 0000.00.00 0000000 00:00:00 0000000
         9 01.04.03 4703.04.01 &#196;&#206; &#205;.&#199;. 00:00:00 0003378



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/toad/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/toad/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.