Re: Is there a bitfield type field in oracle?

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Thu, 31 Jan 2008 00:17:51 -0800 (PST)
Message-ID: <6e25d1c3-efdc-4af2-99a8-fda10e345743@c23g2000hsa.googlegroups.com>


On Jan 30, 4:50 pm, dean <deanbrow..._at_yahoo.com> wrote:
> I have a general question here on how best to implement this: We have
> a table called TRAIN that holds around 10K records of railroad data. A
> client of ours wants to be able add a field that specifies which of
> the 365 days of a year the train runs.

Are you talking about days of every year (i.e. day 176) or are you talking about particular dates (2nd March 2009)?

> I can think of a few ways of doing this:
>
> 1) Add 365 fields of varchar2(1), each of which holds a 'Y' or a 'N'
> entry to state whether the train runs that day.
>
> 2) Add a foreign key to an external table that holds unique date
> ranges.

Why would you want to add a FK to your TRAINS table? IMHO a more natural solution would be to add another table TRAIN_RUNS with two columns, TRAIN_PK (FK into TRAINS), DATE or NUMBER(3) and enter all valid combinations.

Kind regards

robert Received on Thu Jan 31 2008 - 02:17:51 CST

Original text of this message