SOURCE |
---|
create or replace TRIGGER t_creneaux_2 BEFORE INSERT OR UPDATE ON creneaux FOR EACH ROW DECLARE compte number; groupe_impossible EXCEPTION; BEGIN SELECT COUNT(g.p_id) INTO compte FROM groupes g, groupes_parentes gp, groupes formateur, types_groupes tg WHERE g.p_id = :new.pf_formateur AND gp.pf_fils = g.p_id AND formateur.p_id = gp.pf_pere AND tg.p_id = formateur.f_type AND tg.libelle = 'formateur'; IF (compte != 1 AND :new.pf_formateur != NULL) THEN RAISE groupe_impossible; END IF; END; |