You could also just return the name of the temp table, or return nothing
and directly use that name manually outside the function to do select *
from pg_temp.my_data
Hi,
Just one question
Isn't it possible to write a function that return an oid?
So.. One can write a function which create a temp table, feed it according
to parameters and then return the oid of the created temp table.
No??
Le ven. 19 nov. 2021 à 23:48, David G. Johnston
a écrit :
> On Fri, No
On Fri, Nov 19, 2021 at 3:37 PM Abdul Mohammed
wrote:
> I read somewhere that you could have a table as a return type. I,
> therefore tried using the pivot table alias as the return type but got an
> error along lines of the alias not being recognized.
>
A table in that context is something you
Many thanks for the explanations David.
My failed attempts and your explanations have forced me to realise that I
need to spend some time learning to walk before attempting to run.
Much regards
On Fri, Nov 19, 2021 at 1:31 PM David G. Johnston <
david.g.johns...@gmail.com> wrote:
> On Thu, Nov 1
Thank you very much for your response Tom. I will follow your
recommendations. As for the 3rd one, I am actually trying to output the
pivot table I am trying to create using crosstab. I read somewhere that you
could have a table as a return type. I, therefore tried using the pivot
table alias as th
On Thu, Nov 18, 2021 at 4:24 AM Abdul Mohammed
wrote:
> The second part tries to use the string to build a pivot table using the
> crosstab function.
>
Aside from the simple learning curve on how to write functions in
PostgreSQL you also are dealing with the fact that you are dealing with a
quer
Abdul Mohammed writes:
> Sorry for the late response and thank you Pavel for answering. This is my
> first exposure to pgsql, so please bear with me. I am still getting the
> Context message. Here is the modified function:
I tried this, and after creating a dummy "question" table I got
ERROR:
Sorry for the late response and thank you Pavel for answering. This is my
first exposure to pgsql, so please bear with me. I am still getting the
Context message. Here is the modified function:
CREATE OR REPLACE FUNCTION survey_ct ()
RETURNS SETOF text AS $$
DECLARE rec RECORD;
DECLARE str text;
čt 18. 11. 2021 v 12:24 odesílatel Abdul Mohammed
napsal:
> Hello everyone,
> Please I am having a problem with a function I am writing. The first part
> uses a loop that pulls the values from a column and concatenates them into
> a string. This first part works fine. The second part tries to use
Hello everyone,
Please I am having a problem with a function I am writing. The first part
uses a loop that pulls the values from a column and concatenates them into
a string. This first part works fine. The second part tries to use the
string to build a pivot table using the crosstab function. The
10 matches
Mail list logo