From: | M Sarwar <sarwarmd02(at)outlook(dot)com> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org> |
Subject: | RE: Like to RETURN SQL results set |
Date: | 2024-03-28 13:36:12 |
Message-ID: | DM4PR19MB59781BB37765960996434C97D33B2@DM4PR19MB5978.namprd19.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi Laurenz,
I truly appreciate your response.
Sometimes, I am unable to confirm where I am heading.
Thanks,
Sarwar
Sent from my Galaxy
-------- Original message --------
From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Date: 3/28/24 5:19 AM (GMT-05:00)
To: M Sarwar <sarwarmd02(at)outlook(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Like to RETURN SQL results set
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
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2024-03-28 13:47:12 | Re: Like to RETURN SQL results set |
Previous Message | Ron Johnson | 2024-03-28 13:17:19 | Re: upgrade from centos 6.8 to 6.10 |