0
我有以下postgresql函数,其中我试图返回2个名为campusid和campusname的参数。Postgresql函数没有返回表select
CREATE OR REPLACE FUNCTION getall(IN a character varying, IN b character varying)
RETURNS TABLE(id character varying, name character varying) AS
$BODY$
BEGIN
if $1 = 'PK' then
SELECT * from table1;
end if;
END
$BODY$
LANGUAGE plpgsql;
但我得到以下错误:
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 "getallcampuses" line 27 at SQL statement
********** Error **********
ERROR: query has no destination for result data
SQL state: 42601
Hint: If you want to discard the results of a SELECT, use PERFORM instead.
Context: PL/pgSQL function "getallcampuses" line 27 at SQL statement
我需要什么,在功能改变,使之回到我值的表?我也检查了执行查询,但我需要返回一个结果。