Thread: Problems returning multiple columns

Problems returning multiple columns

From
"Travis Hoyt"
Date:
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