Message posté par : Jose CHOCOJ SARCENO
----------------------------------------
Bonjour,
Merci de votre retour. En fait, la couche/table anomalie doit être remplie à chaque fois
qu'il y ait une insertion ou une mise à jour des données de la couche
"cana". Mais j'ai fini par faire marcher la fonction en faisant ceci;
-----------------
Code :
CREATE OR REPLACE FUNCTION f_anomalie_cana()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
VOLATILE NOT LEAKPROOF
AS $BODY$
BEGIN
INSERT INTO
anomalies(id_objet,type_objet,type_anomalie,date,heure,anomalie)
select tt.objectid,
(select
table_name
from information_schema.tables
where table_name ='cana'),
case
when tt.anomalie=1 then 'effondrement'
when tt.anomalie=2 then 'racines'
when tt.anomalie=3 then 'fissures'
when tt.anomalie=6 then 'réparée'
when tt.anomalie=7 then 'déplacements d''assemblage'
when tt.anomalie=8 then 'depot'
when tt.anomalie=9 then 'sable'
when tt.anomalie=10 then 'eau stagnante'
when tt.anomalie=11 then 'perforation'
when tt.anomalie=12 then 'eau claire parasite'
when tt.anomalie=17 then 'poinconnement'
when tt.anomalie=18 then 'curage'
else null
end,
current_date,
current_time,
tt.anomalie
from cana tt where tt.anomalie = new.anomalie and tt.objectid = new.objectid;
RETURN new;
END;
$BODY$;
-----------------
----------------------------------------
Le message est situé
https://georezo.net/forum/viewtopic.php?pid=371450#p371450
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