Using Trigger to Validate Data
537971Oct 9 2006 — edited Oct 10 2006Decided I should start a new thread for this question.
I had an approach to this, but am now wondering if I should start over. When there's an insert, update or delete on an employee history table, we want a trigger to make sure these rules are checked
Employee History Rules
1. EFFECTIVE_START < EFFECTIVE_END
2. EFFECTIVE_START must be the EFFECTIVE_END date of the previous row per SBI_EMPLOYEE_ID
3. EFFECTIVE_START and EFFECTIVE_END ranges cannot overlap per SBI_EMPLOYEE_ID
4. CURRENT_FLAG can only be 'Y' if EFFECTIVE_END = 12/31/9999 11:59:59
5. CURRENT_FLAG can be 'Y' for only one row per SBI_EMPLOYEE_ID per SERVICE_ID
Anyone have a good way of doing this type of data validation with a trigger? Or know of some good online resources to look at some examples of this sort of thing?
Thanks!
Jeff