Re: Execute a query passed by parameters to a function

Поиск
Список
Период
Сортировка
От Thom Brown
Тема Re: Execute a query passed by parameters to a function
Дата
Msg-id bddc86150911090800y61c5a4c0je007f712b7609f2c@mail.gmail.com
обсуждение исходный текст
Ответ на Execute a query passed by parameters to a function  (Yadira Lizama Mue <ylizama@uci.cu>)
Ответы Re: Execute a query passed by parameters to a function  (Yadira Lizama Mue <ylizama@uci.cu>)
Список pgsql-general
2009/11/9 Yadira Lizama Mue <ylizama@uci.cu>:
>
> Hi,
> I have a function which receive a parameters as text. This text is a query. I want to execute this query, but I don't
knowhow. Can any one help me? 
> Regards,
> Yadira
>
>
> CREATE OR REPLACE FUNCTION myfunction(text)
>  RETURNS void AS
> $BODY$
> --I want execute the text I pass by parameters as a query.
> $BODY$
>  LANGUAGE 'sql' VOLATILE
>

You can use EXECUTE
(http://www.postgresql.org/docs/8.4/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN)

Out of curiosity, why would you wish to do such a thing?

Regards

Thom

В списке pgsql-general по дате отправления:

Предыдущее
От: Alexandra Roy
Дата:
Сообщение: Re: PostgreSQL 8.3.8 on AIX5.3 : compilation failed
Следующее
От: Chris Barnes
Дата:
Сообщение: Re: Looking for a script that performs full online backup of postgres in archive mode