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
我需要什麼,在功能改變,使之回到我值的表?我也檢查了執行查詢,但我需要返回一個結果。