Обсуждение: PERFORM function in Plpgsql

Поиск
Список
Период
Сортировка

PERFORM function in Plpgsql

От
Yannick LOUVET
Дата:
hello,

i want to call a function (function1() for example )in an other function.
simple,i guess :

....
PERFORM function1() ;
.....

it's ok, but the name of my function is a variable like :


.....
var_function := function1();
.....
PERFORM var_function;


and it doesn't work !!!
Is it possible to do that ?

thanks


version :
 PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.1
(Mandrake Linux 9.2 3.3.1-1mdk)










Re: PERFORM function in Plpgsql

От
Adam Ruth
Дата:
On Apr 29, 2004, at 9:22 AM, Yannick LOUVET wrote:

> hello,
>
> i want to call a function (function1() for example )in an other
> function.
> simple,i guess :
>
> ....
> PERFORM function1() ;

You will want to use EXECUTE instead (assuming var_function is a text
variable):

EXECUTE var_function;

You may need to add parenthesis and a select:

EXECUTE 'select ' || var_function || '()';

> .....
>
> it's ok, but the name of my function is a variable like :
>
>
> .....
> var_function := function1();
> .....
> PERFORM var_function;
>
>
> and it doesn't work !!!
> Is it possible to do that ?
>
> thanks
>
>
> version :
> PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.1
> (Mandrake Linux 9.2 3.3.1-1mdk)