[postgis-users] IF, ELSE, FOR and WHILE in postgis

Daniel Grum daniel.grum at unibw.de
Mon Oct 12 07:48:41 PDT 2009


Hi, I have a probleme with PostgreSQL and PostGIS.

I need loops for the programming of a PostGIS SQL-script but PostgreSQL  
makes truble.

I think I know how I have to use loops in SQL.-->I need loops to update 
my table line by line!

ELSE PostgreSQl said: "as an expression used underinquiry proved more 
than one line"

The SQL-Skript:
UPDATE einheiten_und_bewegungen
SET the_geom = (SELECT 
ST_Line_SubString(ST_LineMerge(line.the_geom),(1-((Length(line.the_geom)-1000)
            /Length(line.the_geom))),1)
        FROM public.einheiten_und_bewegungen line
        WHERE length(line.the_geom)>1000
        ORDER BY line.gid);

In the table einheiten_und_bewegungen are more than one line!

If there are some ideas please help me!

--daniel



More information about the postgis-users mailing list