Skip site navigation (1) Skip section navigation (2)

how to write cursors

From: La Chi <the_man(dot)inmee(at)yahoo(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: how to write cursors
Date: 2012-04-04 07:30:28
Message-ID: 1333524628.40393.YahooMailNeo@web162203.mail.bf1.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-sql
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 

Responses

pgsql-sql by date

Next:From: Pavel StehuleDate: 2012-04-04 07:36:19
Subject: Re: how to write cursors
Previous:From: msi77Date: 2012-04-04 04:16:44
Subject: Re: Duplicate information in parent and child tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group