Another Option?
Tubby, March 21, 2019 - 2:48 pm UTC
Perhaps changing your data model to store the Booking_Date as well as the Appointment_Date would be a good idea here. Then you could add a check constraint to validate that the appointment date is greater than the booking date, this approach also covers update scenarios if you need to. If you are using SYSDATE in a trigger the update scenarios and what is permissible (if anything) could get a bit muddied.
Cheers,
March 21, 2019 - 3:19 pm UTC
Great suggestion!
A reader, March 22, 2019 - 8:43 am UTC
drop table tmp_test;
create table tmp_test (
c1 date);
alter table tmp_test add
(b1 date invisible default sysdate,
constraint no_past_dates check (c1 >= b1)
);
March 22, 2019 - 10:56 am UTC
I'd prefer to make this as a regular, visible column.