gis
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
import_veloroutes_poi
Parameters
Name
Type
Mode
poitype
text
IN
Definition
BEGIN EXECUTE format(' INSERT INTO veloroutes.%s( description, "type", id_local, geom, id_poi, id_on3v) SELECT description, CASE WHEN EXISTS (SELECT 1 FROM veloroutes.%s_val WHERE UPPER(code) = UPPER(type)) THEN type WHEN EXISTS (SELECT 1 FROM veloroutes.%s_val WHERE UPPER(libelle) = UPPER(type)) THEN (SELECT code FROM veloroutes.%s_val as v WHERE UPPER(v.libelle) = UPPER(type) LIMIT 1) END AS type, id_local, geom, id_poi, id_on3v FROM imports.import_%s WHERE (EXISTS (SELECT 1 FROM veloroutes.%s_val WHERE UPPER(code) = UPPER(type)) OR EXISTS (SELECT 1 FROM veloroutes.%s_val WHERE UPPER(libelle) = UPPER(type)) OR type IS NULL)', poitype, poitype, poitype, poitype, poitype, poitype, poitype); RAISE NOTICE 'Les lignes correctes de % ont été importées dans veloroutes', poitype; RETURN 1; END