Re: help !!! use number or date to store date ????

From: Keith B. McKendry <Keith_McKendry_at_csg.mot.com>
Date: 1995/08/21
Message-ID: <9508211042.ZM29692_at_MFGMPC>#1/1


sptong_at_singnet.com.sg (Tong Siew Pui) wrote:

>If I want to store the month and year in a table, should I use
> year number(4)
> month number(2)
>or
>should I use date to store the value but default the day to 1st of the
>month ???
 

>What are the advantages and disadvantages ?????

I would use the date format for the following reasons:

  1. Validation of input is built-in
  2. large variety of output formats (both numeric and character)
  3. single field to use in comparisons, ordering, and/or indexing
  4. easy to get current month and year (sysdate or to_date(to_char(sysdate,'mmyyyy'),'mmyyyy') )

for numeric to do above

  1. where month between 1 and 12
  2. numeric is easy and char must be passed thru to_char *and* to_date
  3. 2 field for above
  4. must pass sysdate thru to_char and to_num for each field
-- 
McKendry's Uncertainty Principle:
At any given moment, one cannot be certain that any opinion is mine--much 
less SSC's or any client's.

Keith McKendry                     |  73071.3233_at_compuserve.com
SSC Systems Management Consulting  |
Received on Mon Aug 21 1995 - 00:00:00 CEST

Original text of this message