Re: On functions and stored procs

Поиск
Список
Период
Сортировка
От Ed Loehr
Тема Re: On functions and stored procs
Дата
Msg-id 38FDBCAB.87898DBC@austin.rr.com
обсуждение исходный текст
Ответ на On functions and stored procs  ("Graeme Merrall" <graeme@clubnet.net.au>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Javier Benito
Дата:
Сообщение: Sorry, I forgot put the exception in my message...
Следующее
От: "Steve Wolfe"
Дата:
Сообщение: well, shoot. Error loading Pg.so