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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Storing yearless dates.

Re: Storing yearless dates.

From: Pierre Charpenay <pcharpenay_at_unilog.fr>
Date: Fri, 01 Dec 2000 13:43:26 +0100
Message-ID: <3A279CEE.DE6BCFAC@unilog.fr>

Brian Tkatch a écrit :
>
> I'm not doing this, though I am curious.
>
> Imagine I want to store the birthday of a list of people. But the year
> may not always be provided. How would I recognize whch dates had the
> years specified, and which not?

If you store these birthday in a date, Oracle always use a year (by default, the current year - or century - of the system date). In fact, in this example, if you're not sure of the year, just never use it ! To find out if today is the birthday of someone you can do something like this :

  where to_char(birthday, 'DDMM') = to_char(sysdate, 'DDMM')

If you really don't care of the year, the best way is to store this "date" in char, varchar2 or number data, the usage is quite the same :

  where birthday = to_char(sysdate, 'DDMM')

>
> Brian

-- 
 Pierre CHARPENAY
Received on Fri Dec 01 2000 - 06:43:26 CST

Original text of this message

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