1
我想從存儲過程中返回存儲在臨時表中的查詢的結果。我不確定最後的陳述應該是什麼。任何幫助appriciated:如果你不使用TEMP表爲別的Postgresql:從存儲過程返回臨時表
CREATE OR REPLACE FUNCTION public.get_generic_info(
IN in_app_id character varying,
IN key_id uuid)
RETURNS TABLE(info text, last_update timestamp with time zone) AS
$BODY$
BEGIN
CREATE TEMP TABLE result AS
SELECT generic_info.info::text, generic_info.last_update FROM
generic_info
WHERE generic_info.app_id = in_app_id AND generic_info.id = key_id;
-- some data manipulations based on 'result' rows
RETURN ???????;
END;
完美。順便說一下,在第一個解決方案中,列列表中的表名應該是'result'而不是'generic_info'。 – Hans