## PARENTS_ETUDIANTS_Déclencheurs_Row1

SQL
    TRIGGER "ARELV3"."T_PARENTS_ETUDIANTS"
    BEFORE INSERT OR UPDATE ON parents_etudiants
    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_enfant
    AND gp.pf_fils = g.p_id
    AND apprenant.p_id = gp.pf_pere
    AND tg.p_id = apprenant.f_type
    AND apprenant.libelle = 'apprenant'
    AND tg.libelle = 'statut';
    IF (compte != 1)
    THEN
    	RAISE groupe_impossible;
    END IF;
    END;