Bonjour,

J'ai fait un trigger sur une table qui permet de remplir un champ selon la valeur de deux autres.
Or, ce trigger empêche de faire l'insert dans les deux autres champs.
Voici le trigger:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
create or replace TRIGGER DUREE_MISSION AFTER
INSERT OR UPDATE OF heureDepart, heureArrivee ON MISSION
FOR EACH ROW
DECLARE 
dureeMis NUMBER(10,4);
BEGIN
  dureeMis := to_number((:new.heureArrivee - :new.heureDepart)*24);
  UPDATE MISSION SET dureeMission = dureeMis
  WHERE idMission = :new.idMission;
END ;
Erreur SQL : ORA-04091: table MISSION is mutating, trigger/function may not see it
ORA-06512: at "DUREE_MISSION", line 5
ORA-04088: error during execution of trigger 'DUREE_MISSION'
04091. 00000 - "table %s.%s is mutating, trigger/function may not see it"
*Cause: A trigger (or a user defined plsql function that is referenced in
this statement) attempted to look at (or modify) a table that was
in the middle of being modified by the statement which fired it.
*Action: Rewrite the trigger (or function) so it does not read that table.

Merci de votre aide