× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



We have (in a legacy database) a date that is stored as an 8-digit zoned decimal number, YYYYMMDD.

And we have, in order to present that date as an actual date field, an SQL VIEW that calls a UDF defined thusly:

DROP FUNCTION FOO/DISPLAYDAT;
create function FOO/DISPLAYDAT(i_date NUMERIC(8))
returns DATE
language sql deterministic not fenced set option datfmt=*ISO
begin
declare continue handler for sqlexception
return date('99991231000000');
if i_date = 0 then return date('00010101000000'); end if;
return date(digits(i_date) concat '000000');
END

Now, this works great. Unless (1) we're using JDBC, and (2) the underlying numeric date is 0.

Now, if I'm doing a STRSQL session, I either get ++++++++ (if the date format is *MDY), or I get the correct value of January 1, 0001 (if the date format is *ISO or *USA).

But if I'm accessing the database via Squirrel (which uses JDBC), then every time it gets the zeroed-out raw value that produces January 1, 0001, there's an SQL Exception 181, we take a significant performance hit, and the displayed result set shows a year of 2001 instead of 0001.

Now, I'm already being proactive about a raw value of 00000000. But can I be *more* proactive?

--
JHHL

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.