Table as parameter

From: Alex Paulo <alexpaulooliveira(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Table as parameter
Date: 2009-08-14 12:25:18
Message-ID: 90b77fd70908140525v41315b47j80ed2af14c04f67e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Friends of pgsql-general list,

I have a problem: I need put the "table name" as a parameter in a function!
So, When I write, inside that function, the following code:

SELECT INTO var_resposta SUM(campo) FROM $1
return var_resposta;

Knows that $1 is the table name, the postgres said that this is a sintax
error, exactly at $1 position!
Somebody can help me?

Thank you for taking the time!

Best Regards, Alex Paulo.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scara Maccai 2009-08-14 12:37:14 adding a nullable col could rewrite the whole table?
Previous Message Jasen Betts 2009-08-14 10:26:03 Re: PQoidValue - isn't it for...?