[postgis-users] Insert geometry (error) using PL-SQL

David Blasby dblasby at refractions.net
Mon May 12 11:55:22 PDT 2003


Rosangela Silva wrote:

>      poligono := 'POLYGON(('||x1||' '||y1||','||x2||' 
> '||y1||','||x2||' '||y2||','||x1||' '||y2||','||x1||' '||y1||'))';
>      INSERT INTO sp VALUES (geoid,nome,GeometryFromText(poligono,-1));
>     The error message is :
>     ERROR:  Function geometryfromtext(character varying, integer) does 
> not exist
>      Unable to identify a function that satisfies the given argument types
>      You may need to add explicit typecasts
>     My code is:
>  
>     geoid, nome, x1,y1,x2,y2 are variables of my function

This is because PGPSQL thinks poligono  is a VARCHAR(n) variable.

Here's some suggestions:
1. change poligono into a TEXT type variable
2.  change "INSERT INTO sp VALUES 
(geoid,nome,GeometryFromText(poligono,-1));" into
"INSERT INTO sp VALUES 
(geoid,nome,GeometryFromText(geometry(poligono),-1));"
or
"INSERT INTO sp VALUES 
(geoid,nome,GeometryFromText(geometry(text(poligono)),-1));"


dave





More information about the postgis-users mailing list