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

Home -> Community -> Usenet -> c.d.o.misc -> Date Question

Date Question

From: wrgptfan <wrgptfan_at_hotmail.com>
Date: 21 Mar 2006 06:38:04 -0800
Message-ID: <1142951884.579284.224670@i39g2000cwa.googlegroups.com>


I was just playing around with Oracle dates and found something peculiar.

SQL> select to_char((trunc(sysdate)-732757),'DD-MM-YYYY AD HH24:MI:SS') from dual;
00-00-0000 00 00:00:00

SQL> select to_char((trunc(sysdate)-732758),'DD-MM-YYYY AD HH24:MI:SS') from dual;
00-00-0000 00 00:00:00

SQL> select * from v$version;
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production NLSRTL Version 9.2.0.1.0 - Production

SQL> SQL> r
  1 begin

  2     for i in 732750 .. 732760 loop
  3        dbms_output.put_line(to_char(i) || ' - ' ||
to_char((trunc(sysdate) - i),'DD-MM-YYYY AD HH24:MI:SS'));
  4     end loop;

  5* end;
732750 - 09-01-0000 AD 00:00:00
732751 - 08-01-0000 AD 00:00:00
732752 - 07-01-0000 AD 00:00:00
732753 - 06-01-0000 AD 00:00:00
732754 - 05-01-0000 AD 00:00:00
732755 - 04-01-0000 AD 00:00:00
732756 - 03-01-0000 AD 00:00:00
732757 - 02-01-0000 AD 00:00:00
732758 - 01-01-0000 AD 00:00:00
732759 - 31-12-0001 BC 00:00:00
732760 - 30-12-0001 BC 00:00:00

PL/SQL procedure successfully completed.

SQL> ...Dave Kent Received on Tue Mar 21 2006 - 08:38:04 CST

Original text of this message

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