## ETUDIANTS_ABSENCES_Déclencheurs_Row1

SQL
    TRIGGER "ARELV3"."T_ETUDIANTS_ABSENCES_2"
    BEFORE INSERT ON etudiants_absences
    FOR EACH ROW
    DECLARE
    compte number;
    date_creneau date;
    BEGIN
    select date_jour_edt(annee_civile,semaine,jour) into date_creneau from edt
    where p_id = :new.pf_edt;

    select count(*) into compte from absences_justifiees
    WHERE
    f_groupe = :new.pf_groupe
    AND
    date_debut <= date_creneau and date_fin >= date_creneau;
    if compte >= 1 then
      :new.justification := 'aj';
    end if;
    end;