gis
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
import_veloroutes_repere
Parameters
Name
Type
Mode
Definition
BEGIN INSERT INTO veloroutes.repere( libelle, numero_serie, id_local, type_noeud, geom, id_repere, id_on3v) SELECT libelle, numero_serie, id_local, CASE WHEN EXISTS (SELECT 1 FROM veloroutes.repere_val WHERE UPPER(code) = UPPER(type_noeud)) THEN type_noeud WHEN EXISTS (SELECT 1 FROM veloroutes.reperef_val WHERE UPPER(libelle) = UPPER(type_noeud)) THEN (SELECT code FROM veloroutes.repere_val as v WHERE UPPER(v.libelle) = UPPER(type_noeud) LIMIT 1) END AS type_noeud, geom, id_repere, id_on3v FROM imports.import_repere WHERE (EXISTS (SELECT 1 FROM veloroutes.repere_val WHERE UPPER(code) = UPPER(type_noeud)) OR EXISTS (SELECT 1 FROM veloroutes.repere_val WHERE UPPER(libelle) = UPPER(type_noeud))); RAISE NOTICE 'Les lignes correctes de repere ont été importées dans veloroutes'; RETURN 1; END