Bonjour ,
je voudrais passer de ca :
a MERGE , parce que sql%rowcount me renvoit tjrs la valeur 0 , meme si je viens de faire un insert
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 CREATE OR REPLACE TRIGGER trigger_champs BEFORE UPDATE OR INSERT ON PERSONNES FOR EACH ROW DECLARE compt INTEGER; valeur VARCHAR(10); BEGIN if (:new.diffphoto = '1') then valeur:='O' ; else valeur:='N'; end if; update asynchrone@exportSynchrone set diffphoto = valeur , date_maj= NVL(:new.date_maj, NVL( :new.dat_creation, '01/01/1999')) where id_personne = substr(:new.id_personne ,1,(length( :new.id_personne )-12)) ; if SQL%ROWCOUNT = 0 then insert into asynchrone@exportSynchrone (diffphoto ,date_maj,id_personne) Values (valeur ,NVL(:new.date_maj, NVL(:new.dat_creation, '01/01/1999')) ,substr(:new.id_personne,1,(length(:new.id_personne)-12)) ) ; end if ; END ;
comment le faire ?
Partager