gis
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
import_veloroutes_portion
Parameters
Name
Type
Mode
Definition
BEGIN --creation des tables element et etape -- import_element DROP TABLE IF EXISTS imports.import_element; CREATE TABLE imports.import_element( id serial, id_portion integer, id_segment integer); -- import_etape DROP TABLE IF EXISTS imports.import_etape; CREATE TABLE imports.import_etape( id serial, id_portion integer, id_itineraire integer); -- adaptation et insertion des portions dans véloroutes UPDATE imports.import_portion SET id_portion = (SELECT veloroutes.insert_import_veloroutes_portion(id_import)) WHERE type_portion IS NOT NULL AND (EXISTS (SELECT 1 FROM veloroutes.portion_val WHERE UPPER(code) = UPPER(type_portion)) OR EXISTS (SELECT 1 FROM veloroutes.portion_val WHERE UPPER(libelle) = UPPER(type_portion))); RAISE NOTICE 'Les lignes correctes de portion ont été importées dans veloroutes'; -- remplissage de import_etape INSERT INTO imports.import_etape( id_portion, id_itineraire) SELECT CAST(id_portion AS integer), lien_itin FROM imports.import_portion WHERE imports.import_portion.lien_itin IS NOT NULL AND id_portion IS NOT NULL; -- remplissage de element_import INSERT INTO imports.import_element( id_portion, id_segment) SELECT CAST(id_portion AS integer), lien_segm FROM imports.import_portion WHERE imports.import_portion.lien_segm IS NOT NULL AND id_portion IS NOT NULL; RETURN 1; END