Problems returning multiple columns

Поиск
Список
Период
Сортировка
От Travis Hoyt
Тема Problems returning multiple columns
Дата
Msg-id DBEMKMGOMJAGKAKEPPEGOEKCDOAA.thoyt@npc.net
обсуждение исходный текст
Список pgsql-sql
CREATE FUNCTION wklyavg(numeric, timestamp, timestamp) RETURNS TEXT AS '        DECLARE                system
ALIASFOR $1;                startdate       ALIAS FOR $2;                enddate         ALIAS FOR $3;
result         numeric;
 
        BEGIN                result := (select (avg(usr) + avg(sys)) from sardata                       where systemid
=system and time between startdate
 
and enddate);                return enddate || result;        END;
' LANGUAGE 'plpgsql';

Above is the function I'm trying to run and I keep getting errors telling
me I need to cast my values.  I've played with it a bit but not knowing
much about casting I was hoping for some help.  I'm basically just summing
a couple of averages for values between two given dates.  I wanted to
return the summed average and the "enddate" as one row.  Any suggestions?

Thanks,

Travis

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

Предыдущее
От: "Nick Fankhauser"
Дата:
Сообщение: Re: convert from sybase to postgresql
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: problem with update from subselect