Re: Stored Procedure to return resultset from multiple delete statements.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Stored Procedure to return resultset from multiple delete statements.
Дата
Msg-id CAKFQuwY7M+nw-sEJKRt3_hmhpZGrEoXVSH7nbAFTUWJUBCzsPQ@mail.gmail.com
обсуждение исходный текст
Ответ на Stored Procedure to return resultset from multiple delete statements.  (Jason Aleski <jason.aleski@gmail.com>)
Список pgsql-sql
On Tuesday, August 4, 2015, Jason Aleski <jason.aleski@gmail.com> wrote:
I have a function that will purge an item out of our inventory system.  This script works and displays the appropriate information in the messages/notices pane.  I would like it to return the notices in a resultset format because only developers have access to the messages/notices pane.  I would like to display the results as a resultset in my application.  The problem is that I'm issuing multiple delete commands which cannot be joined.  I tried creating a temp table at the top of the procedure, then inserted data (rows affected) into the table; but I could not get that method to work. Can anyone point me in a direction on what to look at to get the "table affected" and the "number of rows affected by the delete" into some sort of result set?  Below is my current procedure that is working.  There are actually 3 more tables that need to be purged, but I removed those for now.



Your solution will most easily be accomplished using a combination of "delete ... returning", insert, and cte/with.

David J.

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

Предыдущее
От: Jason Aleski
Дата:
Сообщение: Stored Procedure to return resultset from multiple delete statements.
Следующее
От: "Richard RK. Klingler"
Дата:
Сообщение: Sales report by month and item category