Re: function error

From: Jan Wieck <janwieck(at)yahoo(dot)com>
To: Travis Hoyt <thoyt(at)npc(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: function error
Date: 2002-03-27 20:25:59
Message-ID: 200203272025.g2RKPxH27695@saturn.janwieck.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Travis Hoyt wrote:
> CREATE FUNCTION biwklyavg(text, text, text) RETURNS numeric AS '
> DECLARE
> system ALIAS $1;
> startdate ALIAS $2;
> enddate ALIAS $3;
> result numeric;
>
> BEGIN
> result := (select (avg(usr) + avg(sys)) from sardata where
> systemid = system
> and time between startdate and enddate;
> END;
> ' LANGUAGE 'sql';

What about using a language that actually supports the above
syntax, like plpgsql?

Jan

>
> Hello,
>
> The fuction listed above gives the following error:
>
> ERROR: parser: parse error at or near "alias"
>
> I'm running v7.2. Any ideas? I pulled this directly from the examples in
> the PostgreSQL Developer's Handbook.
>
> Thanks,
>
> Travis

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2002-03-27 20:37:07 Re: function error
Previous Message Travis Hoyt 2002-03-27 20:10:06 Re: function error