Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 8B033DE314A for ; Tue, 3 Apr 2012 04:44:38 -0300 (ADT) Received: from nm6-vm0.bullet.mail.bf1.yahoo.com ([98.139.213.146]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1SEyPr-0000Od-Gt for pgsql-sql@postgresql.org; Tue, 03 Apr 2012 07:44:37 +0000 Received: from [98.139.215.142] by nm6.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2012 07:44:21 -0000 Received: from [98.139.212.225] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2012 07:44:21 -0000 Received: from [127.0.0.1] by omp1034.mail.bf1.yahoo.com with NNFMP; 03 Apr 2012 07:44:21 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 202851.97822.bm@omp1034.mail.bf1.yahoo.com Received: (qmail 57973 invoked by uid 60001); 3 Apr 2012 07:44:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1333439060; bh=snyMJdHwtBmUo2ilrf0btPmKmgV1harXHgAZ24h36Rg=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=qwPLc8qW/S2ZNJCWmJjVvOrdZ0lS3MUWooXG4TPo9As4ZUP+MvGt613+9LNVzamRnONyeSXVOhBWXm2fivVM+ASbV5cb1vr3l+Xq4i2DC/cTjdXcSBA08Ryf4PE3xnk42/GpC409gV7i4MpZw3DP3L9dF94J67A0hHppw2UsXks= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=m6sYbN06A9sGQU5RD2y8LmC0kTBY/OFPfg4o93LR1zc5EoGzzfZm7lfqQkxfWS/AC93s8q9p/Evx413GICIHt3A2fcSiKryn2fMyL63/VZBhLsEGvGKUjj6wfRmQzgPIZkXJiJ9wVo786rpgET0lEN+8/oJ3jYyJiG7JXo8ZOFg=; X-YMail-OSG: v41HJmoVM1nKfFYQeIRlkBZgwg4Yh7L4O6LErvi2KLiMAtP UxyibeH65rLfhH3rn.Ap2pZuvyeKnT8USUTV71F0bA8r6vbkm0Y9HHq1GWcK ZJ0CggmnLX4mKscz94hM9PO6RSKlnvzJflexMKUv0VhKGuoH_X.r6M_H3rj_ zRzmxsitQUt.Q3HbAHZeNFzm0FavjsbbF5X3eBgOqOxI2QmH2_w3_rzW_mWw tW68TFVAE2AYhTmtrhBpeQj9w7uufwTI6qIxkckkMr6PlJPsq7G.x8byfv7o gnIpooX_6HKAzClsPd5i7aivqiZI5TeuJxpuxq7PqqXjMtYd7Udhn20psFrU SYi2XyduGrhbhVgSODCAZZufwicmakzCIeK_IoXxdu1Rmi7VwI5r2U_LzsJV 1LcwYOH2YvzIfW6DUutnXSQwGpkZ9qg-- Received: from [182.178.164.154] by web162204.mail.bf1.yahoo.com via HTTP; Tue, 03 Apr 2012 00:44:20 PDT X-Mailer: YahooMailWebService/0.8.117.340979 Message-ID: <1333439060.57914.YahooMailNeo@web162204.mail.bf1.yahoo.com> Date: Tue, 3 Apr 2012 00:44:20 -0700 (PDT) From: La Chi Reply-To: La Chi Subject: How to write cursors To: "pgsql-sql@postgresql.org" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="15747-1817477543-1333439060=:57914" X-Pg-Spam-Score: 1.6 (+) X-Archive-Number: 201204/2 X-Sequence-Number: 36479 --15747-1817477543-1333439060=:57914 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hello everyone,=0A=0Ai have created this function in which i simply want to= display a column values through a cursor , but=A0unfortunately=A0i am not = getting the column values , this function is showing me simple column name = but not the =A0fields in column.=0A=0ACREATE OR REPLACE FUNCTION foo(id int= ) returns table(user_id int) as=0A$BODY$=0ADECLARE r int;=0ADECLARE rs curs= or for Select userid from customer where area =3D'new_york';=0ABEGIN=0Aopen= rs ;=0Afetch next from rs into r;=0Awhile (found) loop=0Afetch Next from r= s into r;=0AEND loop;=A0=0Aclose rs; =A0=0AEND;=0A$BODY$=0ALANGUAGE plpgsql= ;=0A=0A=0Ai simply want to show all the record from customer table where ar= ea is New=A0York=A0but with the help of cursors.=0Athanks --15747-1817477543-1333439060=:57914 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Hello= everyone,

i have created this function in w= hich i simply want to display a column values through a cursor , but <= /font>unfortunat= ely i am not getting the column values , this function is showing = me simple column name but not the  fields in column.

CREATE OR REPLACE FUNCTION foo(id int) returns table(user_id int) a= s
$BODY$
DECLARE r int;
DECLARE rs cursor for Select userid from custome= r where area =3D'new_york';
BEGIN
=09open rs ;
=09fetch next from rs into r;
= =09while (found) loop
=09fetch Next from rs into r;
<= span class=3D"Apple-tab-span" style=3D"white-space:pre">=09END loop;=  
=09= close rs;  
END;
$BODY$
LANGUAGE plpgsql;

i simply want to show all the record from customer table where = area is New York but with the help of cursors.
thanks=
--15747-1817477543-1333439060=:57914--