Re: how to return a result set from a stored procedure

From: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>
To: Hugo <htakada(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to return a result set from a stored procedure
Date: 2005-06-15 09:43:58
Message-ID: 20050615094358.GD76447@isis.sigpipe.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

# htakada(at)gmail(dot)com / 2005-06-11 08:44:32 -0400:
> Hi everybody
>
> I am trying to write a stored procedure that returns a result set but it is
> not working
> this is the function:
> ///
> CREATE OR REPLACE FUNCTION
> remisiones.fn_get_total_remitidoxprovision1("numeric")
>
> RETURNS SETOF record AS
> $BODY$
> begin
> select rm.provision as provision,
> drm.producto as producto,
> sum(drm.cantidad) as cantidad
> FROM remisiones.remisiones rm, remisiones.detalles_remision drm
> WHERE rm.remision = drm.remision and rm.provision = $1
> GROUP BY rm.provision, drm.producto
> ORDER BY rm.provision, drm.producto;
> end;$BODY$
>
> ///

http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#AEN32875

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Danny Gaethofs 2005-06-15 10:51:47 Best approach setting up PostgreSQL
Previous Message stig erikson 2005-06-15 09:25:50 Re: postgresql rpms (7.4.2, 7.4.5, 7.4.8) for redhat 8.0

Browse pgsql-hackers by date

  From Date Subject
Next Message Zac 2005-06-15 12:29:27 process crash when a plpython function returns unicode
Previous Message Qingqing Zhou 2005-06-15 09:04:46 Re: Autovacuum in the backend