1
我在函數postgress方法中沒有什麼問題。 我有功能:函數在postgres中返回多行,並返回一些空值
CREATE OR REPLACE FUNCTION test(
x integer,
y character varying,
z character varying
)
RETURNS TABLE(x1 int, y1 varchar,n1 varchar,z1 varchar) AS
$BODY$
BEGIN
RETURN QUERY
SELECT x,y,null,z FROM example_tab
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
ROWS 1000;
當我執行這個功能我把錯誤:
Error: Returned type unknown does not match expected type character varying in column 3.
SELECT * FROM test(694531020,'t'::varchar,'t'::varchar)
我應該怎麼做才能正確運行此查詢,並執行該功能???
'選擇X,Y,空:: VARCHAR,z的example_tab'並請從標籤刪除MySQL和SQL服務器 –