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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top