【发布时间】:2015-07-03 11:23:08
【问题描述】:
我想得到一个点的M坐标的类型,使用ST_M和ST_line_interpolate_point等方法,通过SQL就可以得到正确的结果。现在我想把它放到pl/pgsql函数中,它总是有错误,请帮助!谢谢!
create or replace function point_to_M1(x float, y float,z integer)
returns float AS
$$
DECLARE
geom geometry;
begin
select testo.geom from testo where lineid=z;
return st_astext(ST_line_interpolate_point(st_geometryN(geom,1),st_line_locate_point(st_geometryN(geom,1),'point(x y)')));
end;
$$
language plpgsql;
而且这个函数不存在错误,但是当我使用这个函数时,它有错误。
select point_to_m1(80,0,0) from testo;
错误是:
ERROR: query has no destination for result data HINT: If you want to discard the results of a SELECT, use PERFORM instead.CONTEXT: PL/pgSQL function point_to_m1(double precision,double precision,integer) line 5 at SQL statementter code here
我该如何解决这个问题?
【问题讨论】:
标签: postgresql-9.2