E ai pessoal..

Tenho esta função

CREATE OR REPLACE FUNCTION "public"."fc_zoom" (lat varchar [], long 
varchar []) RETURNS integer AS
$body$
DECLARE
     dist Integer;
     length Integer;
     result Integer;
BEGIN
     length := array_upper($1, 1);

     dist := 0;
     result := 0;

     FOR i IN 1 .. length LOOP
         select into dist (point(lat[0],long[0]) <-> 
point(lat[i],long[i]))*100;
         if dist > result then
             result := dist;
         end if;
     END LOOP;

     return result;

EXCEPTION WHEN RAISE_EXCEPTION THEN
   return -1;
END;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

estou tentando executa-la assim:

select fc_zoom(ARRAY['-25.2356','-25.555'],ARRAY['-49.5689','-49.6666']);

mas aparece este erro

ERROR:  function point(character varying, character varying) does not exist
LINE 1: select (point( $1 [0], $2 [0]) <-> point( $1 [ $3 ], $2 [ $3...
                 ^
HINT:  No function matches the given name and argument types. You might 
need to add explicit type casts.
QUERY:  select (point( $1 [0], $2 [0]) <-> point( $1 [ $3 ], $2 [ $3 ]))*100
CONTEXT:  PL/pgSQL function "fc_zoom" line 12 at SQL statement


Alguem poderia dar um help..

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

Responder a