Skip site navigation (1) Skip section navigation (2)

Re: function error

From: "PG Explorer" <pgmail(at)pgexplorer(dot)com>
To: "Travis Hoyt" <thoyt(at)npc(dot)net>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: function error
Date: 2002-03-27 20:06:29
Message-ID: 002601c1d5ca$e2ed5800$c80ba8c0@sabex.com (view raw or flat)
Thread:
Lists: pgsql-sql
Needs a FOR!!

system          ALIAS FOR $1;

Strange that the sample is wrong?


http://www.pgexplorer.com


----- Original Message -----
From: "Travis Hoyt" <thoyt(at)npc(dot)net>
To: <pgsql-sql(at)postgresql(dot)org>
Sent: Wednesday, March 27, 2002 9:59 PM
Subject: [SQL] function error


> 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';
>
> 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
>


In response to

Responses

pgsql-sql by date

Next:From: Travis HoytDate: 2002-03-27 20:10:06
Subject: Re: function error
Previous:From: Travis HoytDate: 2002-03-27 19:59:39
Subject: function error

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group