Okay, this one is driving me nuts.
In sqlplus the query:
select to_date(19960501,'yyyymmdd') from dual;
returns: 01-MAY-96
The query:
select to_char(to_date(19960501,'yyyymmdd'),'mm/dd/yyyy') from dual;
returns: 05/01/1996
This is what you would expect right? The thing that perplexes me is this. I have a procedure that performs a lot of date conversion from a cursor like:
decode(rec.F1DATA, '0', null, '99999999', null, to_date(rec.F1DATA,'YYYYMMDD'))
where rec.F1Data is the field of cursor rec and is like 19960501 or 20030622 for a date format.
When I run the procedure from my main oracle client tools, everything is okay, BUT if I run it from SQLPlus (plus80.exe) or from Oracle Sql worksheet, then the date are converted to the wrong century for dates before 2000. I.e. 19960501 gets converted to 5/1/2096.
This is most annoying. The nls_date_language is set to american and nls_date_format is set to "mm/dd/yyyy" in my init.ora file.
Any ideas?
Thanks
Kerry
In sqlplus the query:
select to_date(19960501,'yyyymmdd') from dual;
returns: 01-MAY-96
The query:
select to_char(to_date(19960501,'yyyymmdd'),'mm/dd/yyyy') from dual;
returns: 05/01/1996
This is what you would expect right? The thing that perplexes me is this. I have a procedure that performs a lot of date conversion from a cursor like:
decode(rec.F1DATA, '0', null, '99999999', null, to_date(rec.F1DATA,'YYYYMMDD'))
where rec.F1Data is the field of cursor rec and is like 19960501 or 20030622 for a date format.
When I run the procedure from my main oracle client tools, everything is okay, BUT if I run it from SQLPlus (plus80.exe) or from Oracle Sql worksheet, then the date are converted to the wrong century for dates before 2000. I.e. 19960501 gets converted to 5/1/2096.
This is most annoying. The nls_date_language is set to american and nls_date_format is set to "mm/dd/yyyy" in my init.ora file.
Any ideas?
Thanks
Kerry