Re: Like to RETURN SQL results set

Поиск
Список
Период
Сортировка
Искать
От
Laurenz Albe
Тема
Re: Like to RETURN SQL results set
Дата
Msg-id
2ed4638d9de6042890f9b95aa596513ffe163416.camel@cybertec.at
Ответ на
Список
Дерево обсуждения
Re: Like to RETURN SQL results set Laurenz Albe <laurenz.albe@cybertec.at>
RE: Like to RETURN SQL results set M Sarwar <sarwarmd02@outlook.com>
Re: Like to RETURN SQL results set Scott Ribe <scott_ribe@elevated-dev.com>
Re: Like to RETURN SQL results set M Sarwar <sarwarmd02@outlook.com>
Re: Like to RETURN SQL results set Erik Wienhold <ewie@ewie.name>
Re: Like to RETURN SQL results set M Sarwar <sarwarmd02@outlook.com>
Re: Like to RETURN SQL results set Scott Ribe <scott_ribe@elevated-dev.com>
Re: Like to RETURN SQL results set M Sarwar <sarwarmd02@outlook.com>
On Wed, 2024-03-27 at 20:40 +0000, M Sarwar wrote:
> I am writing a dynamic function in which number of columns to be retrieved change
> depending on the parameter values passed while invoking the function.
> I am using CROSSTAB in the dynamic SQL.
> Once I prepare a dynamic SQL and I execute, I want the entire result set from
> the executed SQL to be returned to function RETURN.
> Is this possible? If yes, can you please point me to some examples.

No, this is not possible, unless you declare the function as "RETURNS SETOF record".
But then you have to specify the column list when you use the function, e.g.:

  SELECT * FROM func() AS (c1 integer, c2 text)

Yours,
Laurenz Albe


В списке pgsql-admin по дате отправления
От: M Sarwar
Дата:
Сообщение: Like to RETURN SQL results set
От: Laurenz Albe
Дата:
FAQ