On functions and stored procs
От | Graeme Merrall |
---|---|
Тема | On functions and stored procs |
Дата | |
Msg-id | 005001bfa9b9$10dfce90$373c57cb@clubnetisp обсуждение исходный текст |
Список | pgsql-general |
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. The examples in the docs revolve more about creating functions from, well, a function point of view rather than a stored procedure type of view. In that I should probably say my only exposure with SP's in from MS-SQL so I mean that definition. :) 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? As an example, I query a table for a set of user accounts that need processing on a certain day (today). Is it possible to query the table, return a set of results then loop through those results and on each pass, insert data into another table(s)? The conditional I'm referring to in the docs is [<<label>>] FOR record | row IN select_clause LOOP statements END LOOP; Any examples of this sort of thing? Quiet obviously, the docs generally need updating when it comes to functions. Is there a documentation project/team? Regards, Graeme
В списке pgsql-general по дате отправления: