Trigger in oracle SQL - Validation? -
hello guys i'm trying create trigger validate data, i've got table called 'events' , need create trigger give me error when try add event in july.
create or replace trigger concert_trigger after insert on concert when (event_date = 'july') begin alter table concert add constraint chk_concert check (event.date ='july') end;
here trigger have started think way go i'm not sure if right.
thanks, leprejohn
since classwork requires use of trigger you'd want like
create or replace trigger concert_bi before insert on concert each row begin if to_char(event_date, 'mon') = 'jul' raise_application_error(-20666, 'no concerts can scheduled in july'); end if; end concert_bi;
here i'm assuming event_date actual date instead of character string; if bad guess change comparison appropriately.
share , enjoy.