Message posté par : T. Rossini
----------------------------------------
Bonjour,
je n'ai peut être pas compris votre intention, mais le code du trigger ne peut-il pas
être simplifié comme suit ?
-----------------
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)
values
NEW.tt.objectid,
'cana',
case
when NEW.anomalie=1 then 'effondrement'
when NEW.anomalie=2 then 'racines'
when NEW.anomalie=3 then 'fissures'
when NEW.anomalie=6 then 'réparée'
when NEW.anomalie=7 then 'déplacements d''assemblage'
when NEW.anomalie=8 then 'depot'
when NEW.anomalie=9 then 'sable'
when NEW.anomalie=10 then 'eau stagnante'
when NEW.anomalie=11 then 'perforation'
when NEW.anomalie=12 then 'eau claire parasite'
when NEW.anomalie=17 then 'poinconnement'
when NEW.anomalie=18 then 'curage'
else null
end,
current_date,
current_time,
NEW.anomalie
;
RETURN new;
END;
$BODY$;
-----------------
----------------------------------------
Le message est situé
https://georezo.net/forum/viewtopic.php?pid=371445#p371445
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