I have following tables.
ACCOUNTS (Parent Table) with columns as ACC_ID, VALID_FROM and VALID_TO with unique key on ACC_ID, VALID_FROM.
ACCOUNT_BUSII_FUNCTIONS (Child Table) with columns as ACC_ID, BUSINESS_FUNCTION, VALID_FROM and VALID_TO with unique key on ACC_ID, BUSINESS_FUNCTION, VALID_FROM.
VALID_FROM and VALID_TO are dates.
I need to build a relationship where every record deleted in ACCOUNTS (Parent Table) should check for the child record falling in the same date range. Similarly, before inserting into child, check if parent exists with the valid date range.
Obviously, I can not use foreign key constraints as date ranges are involved.
Tried writing a function and calling in CHECK constraint but did not work as CHECK constraint did not allow user defined function.
Am clueless... any help please...
Cheers TZH