Graeme Merrall wrote:
>
> I'm just getting into functions in postgres and I've bumped up against a
> couple issues which I think I need explained. I've had a wee read of the
> archives on this but haven't turned up to much. I think it may be a
> conceptual problem on my part though :)
>
> Is it possible on postgres, using pl/pgsql to create a function that is
> essentially a stored procedure? i.e. go through and execute a series of SQL
> statements and return a value - success or failure for example.
Yes, this is possible with plpgsql. Note you're limited to returning one
value, not a relation.
> Aditionally, from reading the docs on pl/pgsql is it possible to loop
> through a set of rows returned from a query and perform an action on each
> iteration?
Yes.
> Any examples of this sort of thing?
.../src/test/regress/sql/plpgsql.sql
> Quiet obviously, the docs generally need
> updating when it comes to functions. Is there a documentation project/team?
www.postgresql.org
>
> Regards,
> Graeme