Re: Oracle DATE datatype storage.

From: Gary Eckhardt <dcigary_at_txdirect.net>
Date: 1995/07/25
Message-ID: <3v3nca$50s_at_legend.txdirect.net>#1/1


Randy Fought <FOUGHTRL_at_CTRVAX.VANDERBILT.EDU> wrote:

> Internally Oracle stores the DATE datatype in seven bytes.
>One byte for each of the century, year, month, day, hour, minute
>and second.
 

> We don't care about the hour, minute and second and we have
>many dates to store. This seems quite wasteful to store this in
>seven bytes when it could be done in four. Is there a way to internally
>store the date in four bytes?

Not if you want to use the DATE datatype. In cases like the one you've described, I usually store the date in a character format, and perform a TO_DATE on the column when reading and a TO_CHAR on the column when writing. If you do it in this manner, you won't be able to use all the Oracle date functions unless you bring them into a DATE field and then apply the functions.

---------------------------+----------------------------------------------
Gary Eckhardt              |   "in this day & age...music performed by
Database Consultants, Inc. |    humans...hum!?"  --wilde silas tomkyn
dcigary_at_txdirect.net       |  
gary_eckhardt_at_realworld.com| R^3 = "Real World.  Real Smart.  Real Quick."
(210)930-2080              |   http://realworld.com/dciwww/dcihome.html
Received on Tue Jul 25 1995 - 00:00:00 CEST

Original text of this message