From: La Chi <the_man.inmee@yahoo.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: how to write cursors
Date: Wed, 4 Apr 2012 00:30:28 -0700 (PDT)
Message-ID: <1333524628.40393.YahooMailNeo@web162203.mail.bf1.yahoo.com> (raw)
hi every one
i have created this simple function which returns a column of table , i have used simple SELECT statement , i simply want to know how can i achieve the same task with the help of cursor
CREATE OR REPLACE FUNCTION foo(id int)
returns table(cust_id int) as
$BODY$
BEGIN
return query Select userid from customer where proname ='shampoo';
END;
$BODY$
LANGUAGE plpgsql;
how can i write a cursor which should return all the custid who had proname shampoo . i shall be very thankful to you
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: the_man.inmee@yahoo.com
Subject: Re: how to write cursors
In-Reply-To: <1333524628.40393.YahooMailNeo@web162203.mail.bf1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox