How to write cursors - Mailing list pgsql-sql

From La Chi
Subject How to write cursors
Date
Msg-id 1333439060.57914.YahooMailNeo@web162204.mail.bf1.yahoo.com
Whole thread Raw
List pgsql-sql
Hello everyone,

i have created this function in which i simply want to display a column values through a cursor , but unfortunately 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) as
$BODY$
DECLARE r int;
DECLARE rs cursor for Select userid from customer where area ='new_york';
BEGIN
open rs ;
fetch next from rs into r;
while (found) loop
fetch Next from rs into r;
END loop; 
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

pgsql-sql by date:

Previous
From: Gary Stainburn
Date:
Subject: Re: Wrong output from union
Next
From: La Chi
Date:
Subject: Cursor Error