Re: Is there a bitfield type field in oracle?



dean 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.

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.

3) Is there a bitmap-kind of field that could hold one entry in a bit
of an integer type. Such things are available to software developers
who need to compress the data as much as possible.

I'd appreciate a pointer to the right area here, if (3) is available.

Well, you could use a varchar2 of length 365 and enter strings of zeros and ones (or Y's and N's) Of course, I'd only recommend this if you were planning on leaving the project soon and you really hate the people who'll pick it up.

I'm having a hard time deciding whether this is better or worse than option 1.

My $.02 is that anytime you're using dates, use the Oracle DATE datatype so you don't have to reinvent the wheel regarding things like leap years, how many days are in a month, which day of the week it is, formatting the user output etc.

Also, it's a one-to-many relationship (one train, many days). So use a table.

//Walt




.



Relevant Pages

  • Is there a bitfield type field in oracle?
    ... I have a general question here on how best to implement this: ... a table called TRAIN that holds around 10K records of railroad data. ... Is there a bitmap-kind of field that could hold one entry in a bit ...
    (comp.databases.oracle.server)
  • Re: Is there a bitfield type field in oracle?
    ... a table called TRAIN that holds around 10K records of railroad data. ... client of ours wants to be able add a field that specifies which of ...
    (comp.databases.oracle.server)
  • Re: Watford Junction Oyster validators
    ... The exit plus entry didn't even count as a continuation of my journey as ... stations is that if you enter the station and then exit it again ... drink my train arrived at Watford Junction. ... Cross the train, push the button, doors open onto a Virgin ...
    (uk.transport.london)
  • Re: Railway station or Train Station?
    ... The earliest *American* entry the OED can find is from 1955, ... rich-affluent-wealthy type use the phrase railroad station? ... Upper-class use is now train station." ... Language changes with time, and the people who define 'correct' ...
    (uk.railway)
  • Re: Railway station or Train Station?
    ... those smug people at the OED can remove that "" from after ... The earliest *American* entry the OED can find is from 1955, ... rich-affluent-wealthy type use the phrase railroad station? ... Upper-class use is now train station." ...
    (uk.railway)