I am trying to create a trigger that would check for a null value in column namesdreservation_status from my table passenger and set it to a default value if it's null and show the user a message of it being set to default.
The trigger is created and works fine for setting the default but no message is shown to the user.
create or replace trigger mytrigger
before insert or update on passenger
for each row
when (new.reservation_status IS NULL)
begin
IF :new.reservation_status IS NULL THEN
:new.reservation_status := 'not reserved';
dbms_output.put_line('reservation status invalid, set to default');
end IF;
end mytrigger
/
The value gets changed to 'not reserved' if its null but the message 'reservation status invalid, set to default' isn't displayed. Help.