create or replace trigger check_date before insert or update on duration for each row begin if :new.to_date > :new.from_date then if :new.to_date <= :old.from_date then raise_application_error(-20000,'To Date should be greater than From Date'); end if; else raise_application_error(-20001,'To Date should be greater than From Date'); end if; end; /