SOURCE
create or replace TRIGGER 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';
IF (compte != 1)
THEN
	RAISE groupe_impossible;
END IF;
END;