Search Postgresql Archives

ERROR: control reached end of function without RETURN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all.

I created a function, using EMS:

CREATE OR REPLACE FUNCTION "geo_schema"."search_geo" () RETURNS SETOF varchar AS

$body$

declare x_longlat cursor for select long_lat from h2s ;

declare var_longlat public.geometry ;

declare x_id varchar ;

begin

     open x_longlat ;

     <<loop1>>

     loop

         fetch x_longlat into var_longlat ;

         if not found then

            close x_longlat ;

            exit ;

         end if ;

         select field_id from geo_table

         where within(var_longlat, geo_polygon) limit 1 into x_id ;

         if x_id <> '' then

            return next x_id ;

         end if ;

     end loop ;

end ;

$body$

LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

When I debug it (using EMS tools), it works fine, and I get 73 rows, but when I run it like:

select * from search_geo() ;

I get the error: ERROR:  control reached end of function without RETURN

 

What can be wrong?

 

TIA

Ignacio.

 

-----------------------------------------------

Ignacio Colmenero

Software Development

Micotan Software Company Ltd.

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux