Ola pessoal estou tendo um problema em uma query.

$2 = longitude varchar
$1 = latitude varchar

   qry := 'SELECT cast((''POINT(' || $2 || ' ' || $1 || ')'' 
<->CIDADE.COORDENADA)*100 as float) AS MINDIS
               from CIDADE
               where cidade.id_class_group = ' || idClass ||
               ' and cidade.'||$5||' = 1 order by 1 limit 1;';

                execute qry into RsDis;

_*ERRO:*_
 invalid input syntax for type point: "POINT(-49.000 -25.000)"

Nao sei pq este erro, pois tenho uma outra funcao que utilizo o POINT da 
mesma forma e esta funcionando, a funcao OK esta abaixo:

 x := 'SELECT logradouro, bairro, cidade, estado, num_inicio, num_fim,

       distance( the_geom, GeomFromText( ''POINT(' || $2 || ' ' || $1 || 
')'', -1 ) ) as dif FROM mapas.'||$3||'

       WHERE distance( the_geom, GeomFromText( ''POINT(' || $2 || ' ' || 
$1 || ')'', -1 ) ) <= 0.007 and logradouro is not null

       order by dif

       limit 1;';

-- 
Vinicius D. Barba
Totalsat - Departamento TI
(41) 2109-7716

_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a