Re: Return Table in StoredProceure/Function

Поиск
Список
Период
Сортировка
От Tony Shelver
Тема Re: Return Table in StoredProceure/Function
Дата
Msg-id CAG0dhZB93RJ7gd2dq7L814yAXWMn3_n0O8NQ1YCuTFSY81k+-w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Return Table in StoredProceure/Function  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: Return Table in StoredProceure/Function
Re: Return Table in StoredProceure/Function
Список pgsql-general
Well then SQL Server breaks that rule big time :)
Most people coming from a SQL Server background expect procedures to return a result set that can be queried, and in-out or out parameters to return variables for further information.



On Wed, 20 Nov 2019 at 17:20, Thomas Kellerer <spam_eater@gmx.net> wrote:
İ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.




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

Предыдущее
От: Tony Shelver
Дата:
Сообщение: Re:
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Return Table in StoredProceure/Function