From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | Sairam Krishnamurthy <kmsram420(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Table name as parameter |
Date: | 2011-05-09 20:59:21 |
Message-ID: | 4DC855A9.9050407@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 05/09/2011 12:33 PM, Sairam Krishnamurthy wrote:
> All,
>
> I have a function that takes the table name the parameter. After some
> digging I found that this can be made possible by have the query as a
> string and EXECUTE it.
>
> EXECUTE 'SELECT * FROM "' || table || '" WHERE <condition>';
>
> The above works.
>
> But I want the result in a record variable for further processing. So my
> query actually is
>
> EXECUTE 'SELECT * FROM "' || table || '" INTO "record_data" WHERE
> <condition>';
Try.:
EXECUTE 'SELECT * FROM "' || table || '" WHERE
<condition>' INTO record_data;
>
> This one will not work with the following error message:
>
> ERROR: syntax error at or near "INTO"
>
>
> Can some one help me ?
>
> Thanks,
> Sairam Krishnamurthy
> +1 612 859 8161
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2011-05-09 21:45:11 | Re: FILLFACTOR and increasing index |
Previous Message | Merlin Moncure | 2011-05-09 20:37:15 | Re: stunnel with just postgresql client part |