negram
Guest
Хранимая процедура
пытаюсь создать функцию:
CREATE TYPE account_hits AS (id_account int4, hits int4);
CREATE OR REPLACE FUNCTION d() RETURNS SETOF account_hits AS
'declare r account_hits%rowtype;
begin
for r in select id_account, hits from sessions loop
return next r;
end loop;
return;
end;'
LANGUAGE 'plpgsql' VOLATILE;
select d();
получаю:
ERROR: set-valued function called in context that cannot accept a set
CONTEXT: PL/pgSQL function "d" line 4 at return next
помогите, плиз
пытаюсь создать функцию:
CREATE TYPE account_hits AS (id_account int4, hits int4);
CREATE OR REPLACE FUNCTION d() RETURNS SETOF account_hits AS
'declare r account_hits%rowtype;
begin
for r in select id_account, hits from sessions loop
return next r;
end loop;
return;
end;'
LANGUAGE 'plpgsql' VOLATILE;
select d();
получаю:
ERROR: set-valued function called in context that cannot accept a set
CONTEXT: PL/pgSQL function "d" line 4 at return next
помогите, плиз