Bonjour à tous.
Je cherche à créer un trigger quand on choisi une ligne comme ligne par défaut et qui met les autres lignes en condition standard.
MAP_DEFAULT=0 config standard
MAP_DEFAULT=1 config par défault
Le problème est que le trigger est défini sur la même table que je souhaite modifié.
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
36
37
38
39
40
41
42
43
44
45
46
47 CREATE OR REPLACE TRIGGER IND_MAP_BIU Before insert or update ON IND_MANUFACTURING_PLAN Referencing old as old new as new for each row Declare vCmaId gco_compl_data_manufacture.gco_compl_data_manufacture_id%type; vPlan_number varchar2(50); vPlan_version varchar2(5); Begin If inserting Then If :new.ind_manufacturing_plan_id is null Then :new.ind_manufacturing_plan_id := getnewid; End if; :new.a_idcre := pcs.pc_init_session.getuserini; :new.a_datecre := sysdate; If :new.gco_compl_data_manufacture_id is null Then begin select gco_compl_data_manufacture_id into vCmaId from ind_map_param where a_idcre = pcs.pc_init_session.getuserini; exception when others then vCmaId := null; end; :new.gco_compl_data_manufacture_id := vCmaId; End if; Elsif updating Then :new.a_idmod := pcs.pc_init_session.getuserini; :new.a_datemod := sysdate; End if; if :new.MAP_DEFAULT = 1 then select PMA_PLAN_NUMBER,PMA_PLAN_VERSION into vPlan_number,vPlan_version from ind_plan_management where IND_PLAN_MANAGEMENT_ID= :new.PMA_PLAN_ID; update ind_manufacturing_plan set MAP_DEFAULT =0 where GCO_COMPL_DATA_MANUFACTURE_ID= :old.GCO_COMPL_DATA_MANUFACTURE_ID and IND_MANUFACTURING_PLAN_ID <> :old.IND_MANUFACTURING_PLAN_ID; --problème ici update gco_compl_data_manufacture set CMA_PLAN_NUMBER = vPLAN_NUMBER , CMA_PLAN_VERSION = vPLAN_VERSION WHERE GCO_COMPL_DATA_MANUFACTURE_ID= :new.GCO_COMPL_DATA_MANUFACTURE_ID; end if; End ind_map_biu;
Y a t'il une solution pour modifier des lignes d'une table sur laquelle le trigger est défini.
Est-ce que je dois désactiver les triggers avant de l'update pour éviter une récursivité?
Merci
Bonne journée
Partager