vendredi 7 mars 2014

Triggers comparing things


Vote count:

0




I am trying to do a constraint for (Dam.Sex = F) and CONSTRAINT (Sire.Sex = M).


i did this but am not sure if it's correct, am trying to have an if statement where it checks both constraints one another.


create or replace trigger DAM_SEx_Trigger BEFORE INSERT OR UPDATE ON Horse FOR EACH ROW DECLARE DAm_Sex varchar(1); begin select sex into DAm_Sex from Race; if :NEW.Dam =DAm_Sex then



RAISE_APPLICATION_ERROR (-20000, 'Wrong sex!');
END IF;


end DAM_SEx_Trigger;



asked 21 secs ago






Aucun commentaire:

Enregistrer un commentaire