範例:
CREATE OR REPLACE FUNCTION x() RETURNS TABLE(a INT, b TEXT, c TEXT) AS
$$
DECLARE data TEXT := 'Loli';
BEGIN
RETURN QUERY SELECT 5, 'Hello'::TEXT, data;
END;
$$
LANGUAGE plpgsql;
執行: SELECT * FROM x();
結果:
全站熱搜
範例:
CREATE OR REPLACE FUNCTION x() RETURNS TABLE(a INT, b TEXT, c TEXT) AS
$$
DECLARE data TEXT := 'Loli';
BEGIN
RETURN QUERY SELECT 5, 'Hello'::TEXT, data;
END;
$$
LANGUAGE plpgsql;
執行: SELECT * FROM x();
結果:
留言列表