Return cols and rows via stored procedure

From: Robert James <srobertjames(at)gmail(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Return cols and rows via stored procedure
Date: 2013-07-14 21:34:26
Message-ID: CAGYyBggtqT8jhgOz5pcaBcrRMYLKYTT5dqJBg-2k+6ri2opsuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'd like a stored procedure which does something like:

INSERT INTO...
SELECT... -- This should be returned as multicolumn, multifield - just
like a table or view

When I run it, though, instead of getting a table, I get one field
with all the data in it as a compound type. I'd like to return the
results just like a view.

How do I do that?

Additionally, I'd like to put a:
DELETE...
at the end, but still return the SELECT (i.e. what SELECT said before
the DELETE). Is that possible?

Finally, my preference is to do all this in a SQL stored procedure,
not PL/pgSQL or PL/anythingelse.

Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2013-07-14 22:40:17 Re: Return cols and rows via stored procedure
Previous Message BladeOfLight16 2013-07-14 19:25:44 Re: Update big table