Re: Centuries in Oracle SQL * Forms 3.0
From: Gary Myers <101355.3556_at_CompuServe.COM>
Date: 1995/11/28
Message-ID: <49fm88$n3h$1_at_mhafn.production.compuserve.com>#1/1
Date: 1995/11/28
Message-ID: <49fm88$n3h$1_at_mhafn.production.compuserve.com>#1/1
It is possible to write procedures in PL/SQL that 'decide' whether a year
should be assumed to be in the 1900's or 2000's. I'm not too keen on CHAR
date fields, since you loose the automatic date validation. It's easier
to take a six digit date in a DDMMYYYY format (which assumes 00 for the
century), and add the required number of months depending on the two digit
year supplied. EG
if to_number(to_char(:block.date_field,'YY')) < 50 then
:block.date_field := add_months(:block.date_field,24000)
else
:block.date_field := add_months(:block.date_field,22800)
endif;
One thing people should note if they start by assuming 1900's is that there wasn't a 29th of February in 1900, but there will be in 2000.
-- Gary Myers, Analyst/Programmer, Kaisha Technology, West of EnglandReceived on Tue Nov 28 1995 - 00:00:00 CET