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
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:
- Validation of input is built-in
- large variety of output formats (both numeric and character)
- single field to use in comparisons, ordering, and/or indexing
- easy to get current month and year (sysdate or to_date(to_char(sysdate,'mmyyyy'),'mmyyyy') )
for numeric to do above
- where month between 1 and 12
- numeric is easy and char must be passed thru to_char *and* to_date
- 2 field for above
- 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