Hi all,
I am sorry for putting this question in this list. Hope some body may know 'plpgsql' in postgres.
As I am practicing plpgsql I wrote the following code which is not retrieving data.
declare
temprec record;
funcs text;
funcid integer;
begin
funcs := 'success';
for temprec in select * from tbldefaultaccounts loop
-- if record belongs to project function
if temprec.isfunction = 't' then
funcid := 1;
select functionid into funcid from tblFunctionHierarchy where HierarchyName = temprec.fname;
funcs := funcs || ', ' || funcid ;
end if;
end loop;
return funcs;
end;
Can any body say what is problem with this code. I hope it might have problem after where condition.
where tbldefaultaccounts is
daccid serial;
fname varchar(50);
and tblFunctionHierarchy is
functionid serial;
name varchar(50);