0
表格ko
用於將參數傳遞給crtKAIVE
函數。 此表始終爲單行。如何使用表格行值作爲函數參數
我想下面的代碼,但得到的錯誤
ERROR: function expression in FROM cannot refer to other relations of same query level
LINE 15: select * from ko, crtkaive(ko.doktyyp)
如何解決這個問題,這樣KO可以用來傳遞參數crtkaive? 使用Postgres 9.1及更高版本。
CREATE or replace FUNCTION public.crtKAIVE(
_doktyybid text default 'GVY'
)
RETURNS TABLE (
id integer
)
AS $f_crkaive$
select 1
$f_crkaive$ LANGUAGE sql STABLE;
create temp table ko (doktyyp text) on commit drop;
insert into ko values ('G');
select * from ko, crtkaive(ko.doktyyp)