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