Re: how to return a result set from a stored procedure - Mailing list pgsql-general

From Roman Neuhauser
Subject Re: how to return a result set from a stored procedure
Date
Msg-id 20050615094358.GD76447@isis.sigpipe.cz
Whole thread Raw
In response to how to return a result set from a stored procedure  (Hugo <htakada@gmail.com>)
List pgsql-general
# htakada@gmail.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

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Database became very slow(Help PLS)
Next
From: Danny Gaethofs
Date:
Subject: Best approach setting up PostgreSQL