[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: RE: [postgis-users] Problem with syntax in function
From: Ludovico Bianchini <metlud () yahoo ! it>
Date: 2007-05-23 8:45:05
Message-ID: 834504.91191.qm () web31903 ! mail ! mud ! yahoo ! com
[Download RAW message or body]
Great!, both solutions work!
-SQL
CREATE OR REPLACE FUNCTION
myschema.sel_by_pos2(varchar, varchar, varchar,
varchar)
RETURNS SETOF myschema.mytable AS
$BODY$select * from myschema.mytable where
(geom_column
&& GeomFromText('POLYGON((' || $1 || ' ' || $2 || ',
' || $1 || ' ' || $4 || ', ' || $3 || ' ' || $4 || ',
' || $3 || ' ' || $2 || ', ' || $1 || ' ' || $2 ||
'))', 26591));
$BODY$
LANGUAGE 'sql' VOLATILE;
-plpgsql
CREATE OR REPLACE FUNCTION
myschema.sel_by_pos(varchar, varchar, varchar,
varchar)
RETURNS SETOF myschema.mytable AS
$$
DECLARE
str text;
rec record;
BEGIN
str := 'select * from myschema.mytable where
(geom_column
&& SetSRID(''BOX3D(' || $1 || ' ' || $2 || ', ' || $3
> >
' ' || $4 || ')''::box3d, 26591))';
-- For debugging only
raise notice 'str is: %', str;
for rec in execute str loop
return next rec;
end loop;
END
$$ LANGUAGE 'plpgsql' VOLATILE;
Thank you very much!
___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: \
http://it.docs.yahoo.com/nowyoucan.html \
_______________________________________________ postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic