Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 59888475990 for ; Mon, 27 May 2002 02:48:11 -0400 (EDT) Received: from lucidindia.net (unknown [61.11.73.194]) by postgresql.org (Postfix) with ESMTP id 85EA2475943 for ; Mon, 27 May 2002 02:48:05 -0400 (EDT) Received: from a4005 ([192.168.1.18]) by lucidindia.net (8.11.6/8.11.6) with SMTP id g4R6oVN26295 for ; Mon, 27 May 2002 12:20:33 +0530 Message-ID: <001501c2054a$cc98f410$1201a8c0@a4005> From: "shreedhar" To: "pgsql" Subject: Doubt in Plpgsql Date: Mon, 27 May 2002 12:20:30 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0012_01C20578.E4514160" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200205/224 X-Sequence-Number: 4399 This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C20578.E4514160 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all,=20 I am sorry for putting this question in this list. Hope some body may k= now 'plpgsql' in postgres. As I am practicing plpgsql I wrote the following code which is not retr= ieving data. declare temprec record; funcs text; funcid integer; begin funcs :=3D 'success'; for temprec in select * from tbldefaultaccounts loop -- if record belongs to project function if temprec.isfunction =3D 't' then funcid :=3D 1; select functionid into funcid from tblFunctionHierarchy where HierarchyN= ame =3D temprec.fname; funcs :=3D funcs || ', ' || funcid ; end if; end loop; return funcs; =20 end; Can any body say what is problem with this code. I hope it might have probl= em after where condition. where tbldefaultaccounts is=20 daccid serial; fname varchar(50); and tblFunctionHierarchy is functionid serial; name varchar(50); ------=_NextPart_000_0012_01C20578.E4514160 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all,
    I am sorry for putting = this=20 question in this list. Hope some body may know 'plpgsql' in=20 postgres.
    As I am practicing= plpgsql=20 I wrote the following code which is not retrieving data.
 
declare
 temprec record;
 = funcs=20 text;
 funcid integer;
 
begin
 funcs :=3D 'success';
 
 for temprec in select * from=20 tbldefaultaccounts loop
 -- if record belongs to project=20 function
  if temprec.isfunction =3D 't'=20 then
   funcid :=3D 1;
   selec= t=20 functionid into funcid from tblFunctionHierarchy where HierarchyName =3D=20 temprec.fname;
   funcs :=3D funcs || ', '= || =20 funcid ;
 
  end if;
 end loop;
 
 return funcs;
 
end;
 
Can any body say what is problem with this= code. I=20 hope it might have problem after where condition.
 
where tbldefaultaccounts is
       =20     daccid serial;
       =20     fname varchar(50);
 
and tblFunctionHierarchy is
        func= tionid=20 serial;
        name= =20 varchar(50);
------=_NextPart_000_0012_01C20578.E4514160--