Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Y2k and dates

Re: Y2k and dates

From: hazledid <david.hazledine_at_roche.com>
Date: Wed, 05 May 1999 13:02:35 GMT
Message-ID: <LjXX2.3963$vY2.17850@c01read01.service.talkway.com>


On Wed, 05 May 1999 13:57:19 +0200 MesterLars <datb9805_at_knold.ballehs.dk> wrote:
> I have created a table with a date parametre. It seems like the
> date-type stores information like 01-jan-99. But I want to store it like
> 01-jan-1999. [...]

There's a confusion here between the way a date is stored by Oracle, and the way it is displayed by a client application such as SQL*Plus.

Suppose you have a table with a date column and do "SELECT MYDATE FROM MYTABLE" in SQL*Plus. SQL*Plus has to convert the value from an internal date to a character string before it can be displayed. If you don't specify an explicit format mask in your query with the TO_CHAR function,
then SQL*Plus will use the NLS_DATE_FORMAT defined on your client workstation. This defaults on installation to DD-MON-YY, which is why you are seeing
a 2 digit year. If you change NLS_DATE_FORMAT to something like DD-MON-RRRR, or else specify an explicit format mask with a TO_CHAR function,
then you will see a 4 digit year.

David J. Hazledine
Roche Products Limited
40 Broadwater Road
Welwyn Garden City
AL7 3AY
United Kingdom
Registration Number 100674
Tel. +44 (0)1707 366166
--
Posted via Talkway - http://www.talkway.com Exchange ideas on practically anything (tm). Received on Wed May 05 1999 - 08:02:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US