아래 저장 프로시져에서 계속해서 오류남니다. 도와 주세요.
create function invitation_view5(varchar) returns setof record as $$
declare
node RECORD;
begin
for node in
select icourseid,istate,sum(ipass) as ipass
,sum(iunpass) as iunpass
,sum(icandidate)as icandidate
,sum(interviewsend) as interviewsend
,sum(interviewdelay) as interviewdelay
,sum(itake) as itake
from invitationdata
where icourseid in (select courseregisterid from courseregister where coursestate=$1)
group by icourseid,istate loop
return next node;
end loop;
return;
end;
$$ language 'plpgsql';
위와같이 만들고 실행은
select * from invitation_view5() as
t(icourseid int4,istate char,ipass int2,iunpass int2,icandidate int2,interviewsend int2,interviewdelay int2,itake int2);
오류메세지는
ERROR: wrong record type supplied in RETURN NEXT
CONTEXT: PL/pgSQL function "invitation_view5" line 14 at return next
어디가 잘못된건지 잘 이해가 안가요..
테이블 컬럼별 그룹합을 구하는 것인데요..
프로시져 저장할때는 오류가 없는데 실행시 오류가 나네요.
|