[postgis-users] plpgsql build BOX3D
Miguel de la Fuente
mjdelafuente at gmail.com
Wed Nov 2 08:47:01 PST 2005
Hello everybody, I want to do a function that receives as param two points
and returns a box3d from this points, I have tried but I can't do it.
This is my function
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION getprueba1("numeric", "numeric")
RETURNS BOX3D AS
$BODY$
BEGIN
RETURN 'BOX3D('||($1-100)::VARCHAR ||'
'||($2-100)::varchar||','||($1+100)::VARCHAR||'
'||($2+100)::varchar||')'::BOX3D;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION getprueba1("numeric", "numeric") OWNER TO postgres;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is the error
ERROR: BOX3D parser - doesnt start with BOX3D(
CONTEXT: SQL statement "SELECT 'BOX3D('||( $1 -100)::VARCHAR ||' '||( $2
-100)::varchar||','||( $3 +100)::VARCHAR||' '||( $4
+100)::varchar||')'::BOX3D"
PL/pgSQL function "getprueba1" line 3 at return
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
can anybody help me, I can't find where is the error, If I do the same with
a literal string this works, but when I use the pipe for concat strings this
doesnt work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20051102/55d2e9c7/attachment.html>
More information about the postgis-users
mailing list