From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Return Table in StoredProceure/Function
Date: Wed, 20 Nov 2019 16:20:08 +0100
Message-ID: <98ae35b4-8a72-a28d-5902-3f014604c531@gmx.net> (raw)
In-Reply-To: <CALcdmyQc2szTJBWQvzBmizpKji+L_cGk9sw6dSpTZLeasR817A@mail.gmail.com>
References: <CALcdmyQc2szTJBWQvzBmizpKji+L_cGk9sw6dSpTZLeasR817A@mail.gmail.com>
İlyas Derse schrieb am 20.11.2019 um 09:18:
> How can I return table in Stored Procedure ? I can do it in function but I
> have inout parameters.So I can not create in function. What can I do this
> case ?
>
> I guess,It should be like for function :
>
> CREATE or REPLACE FUNCTION public."test" (INOUT "x" integer, INOUT "y" text)
>
> RETURNS TABLE ("id" integer,"filesize" character varying(36))AS $$
> BEGINRETURN QUERYSELECT * FROM public."tbl_employees" ;
> END;$$ LANGUAGE plpgsql;
>
Procedures aren't meant to return anything (in Postgres specifically and in Computer Science in general).
If you want to return something use a function.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: Return Table in StoredProceure/Function
In-Reply-To: <98ae35b4-8a72-a28d-5902-3f014604c531@gmx.net>
References: <CALcdmyQc2szTJBWQvzBmizpKji+L_cGk9sw6dSpTZLeasR817A@mail.gmail.com> <98ae35b4-8a72-a28d-5902-3f014604c531@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox