1

Throughout our system we use a number of lookups. Something that has cropped up is historical data. Is there a right and wrong about whether you should be able to change lookups?

If I have a lookup that represents a list of known locations should they be essentially immutable? If I allowed changes on this table then surely historical records may be inadvertently using the new values.

3
  • Search about slowly changing dimensions. One principle is to have relationships that are only valid for specific periods of time. All your joins then carry these time-ranges around with them.
    – MatBailie
    Apr 25, 2014 at 11:25
  • There's no rule, al depends on what your requirements are. e.g. It might be useful to know a client's previous address. It wouldn't be useful to mail something to them at it. Date based versioning of look up data as suggested by MatBailie and answered by kayakpim is the usual approach. Apr 25, 2014 at 11:32
  • thanks for the pointer to 'slowly changing dimensions'
    – Anubis
    Apr 25, 2014 at 13:05

1 Answer 1

1

You'd need to add a period_start and optional period_end column on each lookup. Then when getting or setting the lookups be sure to check/set the period_start/end. Be careful to establish whether or not it is valid for period_end to be equal to the next period_start e.g.

Select * 
from lookup
where lookup.period_start <sysdate and lookup.period_end >sysdate

I'd suggest doing the checks in a library function in a package to ensure you do the same check each time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.