Bonjour tout le monde,
je dois créer un déclencheur composé qui permet de gérer les tables mutantes.
Voici mon code, actuellement:
Malheureusement, à la compilation, j'ai ce message d'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 CREATE OR REPLACE TRIGGER LimitEtudGroupes FOR INSERT OR UPDATE ON Parcours_HE COMPOUND TRIGGER TYPE ArrayOfRowid IS TABLE OF ROWID INDEX BY BINARY_INTEGER; t_newRowids ArrayOfRowids; v_NbreEtudiants INT; i NUMBER; BEFORE STATEMENT IS BEGIN t_newRowids.DELETE; END BEFORE STATEMENT; AFTER EACH ROW IS BEGIN t_newRowids(t_newRowids.COUNT + 1) := :NEW.ROWID; END AFTER EACH ROW; AFTER STATEMENT IS BEGIN E_MaxEtudiants EXCEPTION; FOR i IN t_newRowids.FIRST.. t_newRowids.LAST LOOP SELECT COUNT(*) INTO v_NbreEtudiants FROM Parcours_HE WHERE ROWID = t_newRowids(i) AND Refgroupe = t_newRowids(i).Refgroupe AND Ansco = t_newRowids(i).Ansco AND Refformdet = t_newRowids(i).Refformdet AND Annetud = t_newRowids(i).Annetud AND Refimplan = t_newRowids(i).Refimplan; IF(v_NbreEtudiants >= 25) THEN RAISE E_MaxEtudiants; END IF; END LOOP; EXCEPTION WHEN E_MaxEtudiants THEN RAISE_APPLICATION_ERROR(-20001, 'Le nombre maximum d''etudiants est depasse pour le groupe ' || :NEW.Refgroupe || ' et l''annee ' || :NEW.Ansco); END AFTER STATEMENT; END LimitEtudGroupes;
et je ne vois pas ce qui fait planter la compilation ... Quelqu'un pourrait-il m'éclaire s'il vous plait ?Erreur(19,18): PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following: := . ( @ % ; The symbol "EXCEPTION" was ignored.
Aussi, est-ce que la requête dans ma boucle FOR est correcte ? J'entends par là, dois-je faire le "WHERE ROWID = t_newRowids(i)" ? Et est-ce que les différents "t_newRowids(i).QuelqueChose" se font de cette façon ? Ou bien je peux accéder à ces valeurs différemment ?
Merci d'avance
Partager