gis
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
insert_import_veloroutes_portion
Parameters
Name
Type
Mode
idimport
integer
IN
Definition
DECLARE id_veloroutes integer; BEGIN INSERT INTO veloroutes.portion( type_portion, mont_subv, annee_subv, id_local, id_on3v, nom, description ) SELECT CASE WHEN EXISTS (SELECT 1 FROM veloroutes.portion_val WHERE UPPER(code) = UPPER(type_portion)) THEN type_portion WHEN EXISTS (SELECT 1 FROM veloroutes.portion_val WHERE UPPER(libelle) = UPPER(type_portion)) THEN (SELECT code FROM veloroutes.portion_val as v WHERE UPPER(v.libelle) = UPPER(type_portion) LIMIT 1) END AS type_portion, CAST (mont_subv AS real), CAST (annee_subv as integer), id_local, id_on3v, nom, description FROM imports.import_portion as ip WHERE ip.id_import = idimport RETURNING id_portion into id_veloroutes; RETURN id_veloroutes; END;