## T_CRENEAUX_1

Details
Grants
References
Dependencies
Code

TEXT
    TRIGGER "ARELV3"."T_CRENEAUX_1"
    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, types_groupes tg
    WHERE g.p_id = :new.pf_apprenants
    AND tg.p_id = g.f_type
    AND (tg.libelle = 'groupe' or tg.libelle = 'grp_edt');
    IF (compte != 1)
    THEN
    	RAISE_APPLICATION_ERROR (-20001,'id apprenants ' || :new.pf_apprenants);
    END IF;
    END;