reject overlapping date range within insert
Posted on 2011-04-18
I have a table
create table test_table(id number,start_date date not null,end_date date);
insert into test_table values (1,sysdate, null);
Now if I want to insert another new row, I need a check condition, such that new row with the same id can't have overlapping date range.
Before inserting a new row the enddate will be updated and the new record start date must be greater than enddate of the exiting data.