Message posté par : Benjamin B
----------------------------------------
Bonjour,
J'ai un petit soucis,
J'ai deux tables, et je souhaiterai que lorsqu'un enregistrement de la première
table est complété, il y ai copie vers une deuxième table de l'enregistrement mis à
jour.
J'ai fait un trigger en before update for each row
ok j'ai du mal avec les trigger....
mais mon insert into ne passe pas.
Pouvez vous m'aider car je ne vois pas ou cela cloche?
-----------------
Code :
create or replace TRIGGER SIR_ARBRE_V2_ENT_FAIT_UP
after update ON SIR_ARBRE_ENTRETIEN_FUTUR FOR EACH ROW
declare
CODE_ENT NUMBER(10):=0;
O_ID NUMBER(10):=0;
begin
if (:NEW.ID_ARBRE_ALIGNEMENT_GLD <> :OLD.ID_ARBRE_ALIGNEMENT_GLD ) then
select CODE_ENTRETIEN_FUTUR into CODE_ENT from SIR.SIR_ARBRE_ENTRETIEN_FUTUR ;
SELECT max(ID_ARBRE_ENTRETIEN_FAIT)+1 into O_ID from SIR.SIR_ARBRE_ENTRETIEN_FAIT;
insert into SIR_ARBRE_ENTRETIEN_FAIT (ID_ARBRE_ENTRETIEN_FAIT,CODE_ENTRETIEN_FAIT) VALUES
(O_ID,CODE_ENT);
insert into SIR_ARBRE_ENTRETIEN_FAIT (ID_ARBRE_ENTRETIEN_FAIT) SELECT
max(ID_ARBRE_ENTRETIEN_FAIT)+2 from SIR.SIR_ARBRE_ENTRETIEN_FAIT ;
END if;
END ;
-----------------
Par avance merci pour toute aide, car je tourne en rond et ne voit pas mon erreur.
----------------------------------------
Le message est situé
https://georezo.net/forum/viewtopic.php?pid=354154#p354154
Pour y répondre : geobd(a)ml.georezo.net ou reply de votre messagerie
Pour vous désabonner connectez-vous sur le forum puis Profil / Abonnement
--
Association GeoRezo - le portail géomatique
https://georezo.net