Re: Max and min date value in Informix IDS 7.31
Posted in 2006
Topics: Stored Procedures & SPL, Versions, Editions & End-of-Life
Not AFAIK
But the following is simple enough.
create procedure minDate() returning date;return( date('1/1/0001'));
end procedure;
create procedure maxDate() returning date;return( date('12/31/9999') );
end procedure;
or if you think the integer is faster and also ensures future
consulting fees:
create procedure minDate() returning date;return( date(-693594) );
end procedure;
create procedure maxDate() returning date;return( date(2958464) );
end procedure;
select minDate(), maxDate() from systables where tabid = 1;
This is a good way to make sure you don't get caught when Informix has
to convert to 5 digit year format shortly before the 10th millineum. (I
am sure they will wait to the last second again.)
I plan to be dead and let the COBOL programmers make the changes. :-)
Seriously, this isn't a bad idea to do.
bozon wrote:
> Not AFAIK
> But the following is simple enough.
>
> create procedure minDate() returning date;> return( date('1/1/0001'));
> end procedure;
That's good unless the server gets started with DBDATE=Y4MD- in the
environment. The most reliable way of constructing dates is the MDY()
function:
RETURN MDY(1,1,1);
> create procedure maxDate() returning date;> return( date('12/31/9999') );
> end procedure;
RETURN MDY(12,31,9999);
> [...]
> This is a good way to make sure you don't get caught when Informix has
> to convert to 5 digit year format shortly before the 10th millineum. (I
> am sure they will wait to the last second again.)
No; I plan to deal with the Y10K problem starting January 2nd 5000. Do
you really see a need to start on it before then?
Besides, the SQL standard only requires the (so-called 'proleptic')
Gregorian Calendar over the range 0001-01-01 .. 9999-12-31. We'd have
to worry about a DBMILLENNIUM environment variable, and maybe a
DBDECAMILLENNIUM? We'll probably ensure that the revised scheme will
last longer than the universe is planned to last - do you think that's
too conservative? Or not...design details for 2994-odd years hence.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2005.02 -- http://dbi.perl.org/