[Trigger] Probleme à l'insertion
Bonjour
j ai réalisé un trigger se déclenche au moment de l' insertion a une table (donnée) et il fais une opération d insertion a une autre table (donnée) en respectant une condition (donnée)
sa marche très bien avec les table t4 et t5
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| CREATE TABLE T4 (a INTEGER, b CHAR(10));
CREATE TABLE T5 (c CHAR(10), d INTEGER);
CREATE TRIGGER trigger
AFTER INSERT ON T4
REFERENCING NEW AS newRow
FOR EACH ROW
WHEN (newRow.a <= 10)
BEGIN
INSERT INTO T5 VALUES(:newRow.b, :newRow.a);
END trig1;
.
run; |
Mais quand je fais se lui la ::
Code:
1 2 3 4 5 6 7 8 9 10 11
| SQL> run;
1 CREATE TRIGGER trig1
2 AFTER INSERT ON dem_ins
3 REFERENCING NEW AS newRow
4 FOR EACH ROW
5 WHEN (newRow.acc_ins='o')
6 BEGIN
7 INSERT INTO list_elec VALUES(0,:newRow.n_dmins ,0);
8* END trig1;
Trigger created. |
La création c est bon (trigger est crée)
Mais au moment de l'insertion d'1 tuple a ma table dem_ins je trouve les problèmes
Code:
1 2 3 4 5
| SQL> INSERT INTO dem_ins VALUES(1,TO_DATE('03-01-2003','DD-MM-YYYY'),'ahmed','saya' ,TO_DATE('06-01-2003', 'DD-MM-YYYY'),'a','k','r','alger','rue1','o','',01);
ERROR at line 1:
ORA-04091: table ROS.DEM_INS is mutating, trigger/function may not see it
ORA-06512: at "ROS.TRIG1", line 2
ORA-04088: error during execution of trigger 'ROS.TRIG1' |