Received: from lin.local.lan ([216.221.221.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f19KHbx35606 for ; Fri, 9 Feb 2001 15:17:37 -0500 (EST) (envelope-from najm@mondo-live.com) Received: from mondo-live.com (IDENT:najm@ll20.local2.lan [192.168.2.20]) by lin.local.lan (8.9.3/8.8.7) with ESMTP id TAA19436; Fri, 9 Feb 2001 19:11:51 GMT Message-ID: <3A85A333.C4DA82EF@mondo-live.com> Date: Sat, 10 Feb 2001 15:23:15 -0500 From: Najm Hashmi X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: Jie Liang CC: pgsql Subject: Re: What's wrong with this function References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/179 X-Sequence-Number: 1365 Jie Liang wrote: > I just know you can use implict cursor inside the plpgsql > e.g > declare result text; tcount int4; > > rec record; > begin > FOR rec IN select_clause LOOP > statements > END LOOP; > end; > Thank you Jie for your help. I am bit confused about how it works. I want for each row , obtained by select statment, get certain values and then do some calculations and out put that resulst eg for rec IN select title, dcount from songs where artist='xyz' tcount:= tcount+rec.dcount; END LOOP; return tcount; would this work ? Thanks again for your help. Regards, Najm