table name as variable within Function

Поиск
Список
Период
Сортировка
От Clark Allan
Тема table name as variable within Function
Дата
Msg-id 4a7a732105070711222daafaf4@mail.gmail.com
обсуждение исходный текст
Ответы Re: table name as variable within Function  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
Here is an example of what i would like to do...
---------------------------------------
CREATE FUNCTION fun_totalrecords(varchar) RETURNS int8 AS'
DECLARE
theTable ALIAS FOR $1;
result int := 0;
BEGIN
result = COUNT(*) FROM theTable; -- this is where i need help
 
RETURN result;

END; 'LANGUAGE 'plpgsql';
---------------------------------------
Thanks for the help....
Clark
 

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

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: How to force Postgres to calculate MAX(boolean)
Следующее
От: Ying Lu
Дата:
Сообщение: find objects under a specific tablespace