As I have read what I can about implicit versus explicit dates, I have come across something I find a bit odd. I've tried to simplify it here in this anonymous block.
declare
bad_year varchar2(30);
good_year varchar2(30);
neutral_year varchar2(30);
testdate date;
neutraldate date;
begin
testdate := to_date('01-JAN-50', 'DD-MON-YY');
--test one
bad_year := to_char(testdate, 'DD-MON-YYYY');
dbms_output.put_line(bad_year);
--test two
neutral_year := to_char(testdate, 'DD-MON-YY');
neutraldate := to_date(neutral_year);
good_year := to_char(neutraldate, 'DD-MON-YYYY');
dbms_output.put_line(good_year);
end;
The results:
01-JAN-2050
01-JAN-1950
I would think that unless you are altering your session between tests and changing the NLS_DATE_FORMAT, that the results would at least be consistent.
This has truly got me stumped.
Anyone out there understand this?
thank you,
Kristi