Table name as parameter in function

Поиск
Список
Период
Сортировка
От Alexander Pucher
Тема Table name as parameter in function
Дата
Msg-id 41A3A3EE.5020301@atlas.gis.univie.ac.at
обсуждение исходный текст
Ответы Re: Table name as parameter in function  (Timothy Perrigo <tperrigo@wernervas.com>)
Список pgsql-general
Hi,

struggling around with this for some time:

How can I use a table name as a parameter in a PL/pgSQL function ??

I tried this but it didn't work...


CREATE OR REPLACE FUNCTION my_row_count(text) RETURNS int4 AS '
DECLARE
    num_rows int4;
BEGIN
    num_rows := (select count(*) from $1);
    RETURN num_rows;
END;
' LANGUAGE plpgsql;

Thnaks for any input!

regards,
alex.

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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Upcoming Changes to News Server ...
Следующее
От: "Gary L. Burnore"
Дата:
Сообщение: Re: Upcoming Changes to News Server ...